mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-10-28 20:18:16 -04:00
Check for style being nil in renderText helper
This commit is contained in:
1 parent
f27536eeb4
commit
e43288b69c
1 file changed
+3
@@ -17,6 +17,8 @@ type BaseElement struct {
|
||||
|
||||
func renderText(w io.Writer, rules *ElementStyle, s string) {
|
||||
out := aurora.Reset(s)
|
||||
|
||||
if rules != nil {
|
||||
if rules.Color != "" {
|
||||
i, err := strconv.Atoi(rules.Color)
|
||||
if err == nil && i >= 0 && i <= 255 {
|
||||
@@ -51,6 +53,7 @@ func renderText(w io.Writer, rules *ElementStyle, s string) {
|
||||
if rules.Blink {
|
||||
out = out.Blink()
|
||||
}
|
||||
}
|
||||
|
||||
_, _ = w.Write([]byte(out.String()))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user