aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-03-03 14:01:27 +0200
committerTulir Asokan <tulir@maunium.net>2020-03-03 14:01:27 +0200
commit43212996e9486c40402d36d1c64071f696f2c683 (patch)
treee8e3dd11056407a03db11aa0cbc9132b7d179bfc /ui
parentc829e436e46ace700045eaaf31bc4abf286e1156 (diff)
Add another nil check in room list
Diffstat (limited to 'ui')
-rw-r--r--ui/tag-room-list.go6
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
}