diff options
-rw-r--r-- | ui/tag-room-list.go | 6 |
1 files changed, 5 insertions, 1 deletions
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 } |