fix crash when emitting empty messages in text format (#153)

This commit is contained in:
Serge Bazanski 2020-04-23 22:20:45 +02:00 committed by GitHub
parent 36f9e53dfd
commit 8e2cf9b3c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -179,7 +179,7 @@ func (tf *textFormatter) format(m proto.Message) (string, error) {
// no trailing newline needed // no trailing newline needed
str := buf.String() str := buf.String()
if str[len(str)-1] == '\n' { if len(str) > 0 && str[len(str)-1] == '\n' {
str = str[:len(str)-1] str = str[:len(str)-1]
} }