Fix panic if replaceBuffer() is called with message not in buffer. Fixes #32

This commit is contained in:
Tulir Asokan 2018-04-23 20:13:42 +03:00
parent 9308f4cb47
commit 16406d6c91

View File

@ -231,6 +231,12 @@ func (view *MessageView) replaceBuffer(original messages.UIMessage, new messages
} }
} }
if start == -1 {
debug.Print("Called replaceBuffer() with message that was not in the buffer:", original)
view.appendBuffer(new)
return
}
if len(view.textBuffer) > end { if len(view.textBuffer) > end {
end++ end++
} }