diff --git a/src/ansi.go b/src/ansi.go index 0d716c0..b4f98f6 100644 --- a/src/ansi.go +++ b/src/ansi.go @@ -201,7 +201,7 @@ func interpretCode(ansiCode string, prevState *ansiState) *ansiState { state = &ansiState{prevState.fg, prevState.bg, prevState.attr, prevState.lbg} } if ansiCode[0] != '\x1b' || ansiCode[1] != '[' || ansiCode[len(ansiCode)-1] != 'm' { - if strings.HasSuffix(ansiCode, "0K") { + if strings.HasSuffix(ansiCode, "0K") && prevState != nil { state.lbg = prevState.bg } return state