dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 211a1e400673160b16ad955129a88db9d28701bc
parent 99d5da4c0ab82fdb9a33923980a8a6e328b4cd75
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed,  6 Dec 2023 15:06:10 -0500

fix crash

Diffstat:
Mpkg/web/handlers/poker/poker.go | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -199,9 +199,11 @@ func NewOngoing(g *PokerGame) *Ongoing { func newLogEvent(g *PokerGame, roomLogsTopic, msg string) { logEvt := LogEvent{Message: msg} PokerPubSub.Pub(roomLogsTopic, logEvt) - g.Ongoing.LogEventsMtx.Lock() - g.Ongoing.LogEvents = append(g.Ongoing.LogEvents, logEvt) - g.Ongoing.LogEventsMtx.Unlock() + if g.Ongoing != nil { + g.Ongoing.LogEventsMtx.Lock() + g.Ongoing.LogEvents = append(g.Ongoing.LogEvents, logEvt) + g.Ongoing.LogEventsMtx.Unlock() + } } // Return either or not the game ended because only 1 player left playing