Skip to content

Commit

Permalink
fix: check data nil
Browse files Browse the repository at this point in the history
Signed-off-by: aimuz <mr.imuz@gmail.com>
  • Loading branch information
aimuz committed May 17, 2023
1 parent ec6347c commit 5c4e670
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion klog.go
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ func (l *loggingT) output(s severity.Severity, logger *logWriter, buf *buffer.Bu
if logger.writeKlogBuffer != nil {
logger.writeKlogBuffer(data)
} else {
if data[len(data)-1] == '\n' {
if len(data) > 0 && data[len(data)-1] == '\n' {
data = data[:len(data)-1]
}
// TODO: set 'severity' and caller information as structured log info
Expand Down

0 comments on commit 5c4e670

Please sign in to comment.