Don't allow unread count to go below zero

This commit is contained in:
Peter Stuifzand 2018-06-30 15:48:05 +02:00
parent 59a784f326
commit b7b706368a

View File

@ -716,6 +716,9 @@ func (b *memoryBackend) MarkRead(channel string, uids []string) {
unread -= len(uids) unread -= len(uids)
if ch, e := b.Channels[channel]; e { if ch, e := b.Channels[channel]; e {
if unread < 0 {
unread = 0
}
ch.Unread = unread ch.Unread = unread
b.Channels[channel] = ch b.Channels[channel] = ch
} }