diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-04-23 20:13:42 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-04-24 02:13:43 +0300 |
commit | 16406d6c91acf322463b64d03a49af6aebc02834 (patch) | |
tree | 93b08e13e1a0a7dd33bb27f7dc0f54256db08124 /ui | |
parent | 9308f4cb47fa7ce2392185ca904ff7b1d11fe1bc (diff) |
Fix panic if replaceBuffer() is called with message not in buffer. Fixes #32
Diffstat (limited to 'ui')
-rw-r--r-- | ui/message-view.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/message-view.go b/ui/message-view.go index 71d1cba..ca03e73 100644 --- a/ui/message-view.go +++ b/ui/message-view.go @@ -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 { end++ } |