Prevent possible segfault on picking message IDs for deletion
This commit is contained in:
parent
0013baa247
commit
3e791db201
|
@ -251,6 +251,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
|
|||
if c.me == nil {
|
||||
return "@me is not initialized", true
|
||||
}
|
||||
|
||||
var limit int32
|
||||
if len(args) > 0 {
|
||||
limit64, err := strconv.ParseInt(args[0], 10, 32)
|
||||
|
@ -275,7 +276,9 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
|
|||
|
||||
var messageIds []int64
|
||||
for _, message := range messages.Messages {
|
||||
messageIds = append(messageIds, message.Id)
|
||||
if message != nil {
|
||||
messageIds = append(messageIds, message.Id)
|
||||
}
|
||||
}
|
||||
|
||||
_, err = c.client.DeleteMessages(&client.DeleteMessagesRequest{
|
||||
|
|
Loading…
Reference in a new issue