From b7b706368acd29d1793cf42eaff80c0f15d888c0 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sat, 30 Jun 2018 15:48:05 +0200 Subject: [PATCH] Don't allow unread count to go below zero --- cmd/eksterd/memory.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/eksterd/memory.go b/cmd/eksterd/memory.go index de247fd..1f3339a 100644 --- a/cmd/eksterd/memory.go +++ b/cmd/eksterd/memory.go @@ -716,6 +716,9 @@ func (b *memoryBackend) MarkRead(channel string, uids []string) { unread -= len(uids) if ch, e := b.Channels[channel]; e { + if unread < 0 { + unread = 0 + } ch.Unread = unread b.Channels[channel] = ch }