From 556c490ac49f93b97d74495763b0f66924cc8542 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 5 Dec 2019 17:52:22 +0100 Subject: [PATCH] Fix nil pointer access when style is unused --- baseelement.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/baseelement.go b/baseelement.go index c21fcbe..2b0d2bd 100644 --- a/baseelement.go +++ b/baseelement.go @@ -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