From 43212996e9486c40402d36d1c64071f696f2c683 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 3 Mar 2020 14:01:27 +0200 Subject: Add another nil check in room list --- ui/tag-room-list.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/tag-room-list.go b/ui/tag-room-list.go index b192fd3..ca24d4e 100644 --- a/ui/tag-room-list.go +++ b/ui/tag-room-list.go @@ -189,7 +189,7 @@ func (trl *TagRoomList) Insert(order json.Number, mxRoom *rooms.Room) { } } trl.rooms = append(trl.rooms, nil) - copy(trl.rooms[insertAt+1:], trl.rooms[insertAt:]) + copy(trl.rooms[insertAt+1:], trl.rooms[insertAt:len(trl.rooms)-1]) trl.rooms[insertAt] = room } @@ -210,6 +210,10 @@ func (trl *TagRoomList) Bump(mxRoom *rooms.Room) { roomBeingBumped = currentIndexRoom } } + if roomBeingBumped == nil { + debug.Print("Warning: couldn't find room", mxRoom.ID, mxRoom.NameCache, "to bump in tag", trl.name) + return + } // If the room being bumped should be first in the list, it won't be inserted during the loop. trl.rooms[len(trl.rooms)-1] = roomBeingBumped } -- cgit v1.2.3