Fix nil pointer access when style is unused

This commit is contained in:
Christian Muehlhaeuser
2019-12-05 17:52:22 +01:00
parent e608d2e25e
commit 556c490ac4
+2 -2
View File
@@ -49,8 +49,8 @@ func renderText(w io.Writer, rules *ElementStyle, s string) {
return
}
// FIXME: ugly hack
if os.Getenv("COLORTERM") == "truecolor" {
// FIXME: ugly true-color ANSI support hack
if rules != nil && os.Getenv("COLORTERM") == "truecolor" {
bg, err := colorSeq(rules.BackgroundColor)
if err == nil {
s = "\x1b[48;2;" + bg + s