From db6e367facb4f5a1198ff32b3d4ca2b4cf03a2fc Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Tue, 22 Oct 2019 08:05:51 -0400 Subject: [PATCH] Bugfix: Up arrow in stream/start crashes application --- cmdEdit.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmdEdit.go b/cmdEdit.go index af40142..889ac5f 100644 --- a/cmdEdit.go +++ b/cmdEdit.go @@ -25,10 +25,16 @@ func cmdEdit(cmd []string) { if len(cmd) == 2 || len(cmd) == 1 { if len(cmd) == 2 { messageId, _ = strconv.Atoi(cmd[1]) - } else { + } else if lastMessage.ID != 0 { + if lastMessage.Type != "text" { + printToView("Feed", "Last message isn't editable (is it an edit?)") + return + } messageId = lastMessage.ID + } else { + printToView("Feed", "No message to edit") + return } - origMessage, _ := chat.ReadMessage(messageId) if origMessage.Result.Messages[0].Msg.Content.Type != "text" { printToView("Feed", fmt.Sprintf("%+v", origMessage))