From 56590056f2669f53aded8bffb9621c8a967a9f03 Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 4 Nov 2024 09:41:22 +0100 Subject: [PATCH] fix fromJust issue --- src-server/Server/Communication/Handler.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src-server/Server/Communication/Handler.hs b/src-server/Server/Communication/Handler.hs index e806841..7e1095f 100644 --- a/src-server/Server/Communication/Handler.hs +++ b/src-server/Server/Communication/Handler.hs @@ -67,8 +67,11 @@ handleMessage stateContainer readerContainer msg = do currentPlayers <- STM.atomically $ STM.readTMVar (scPlayers stateContainer) let newPlayers = filter (\p -> playerId p /= clientId) currentPlayers void $ STM.atomically $ STM.swapTMVar (scPlayers stateContainer) newPlayers - let client = find (\a -> csUUID a == Just clientId) socks - dropClient curLevel socketList queueList (csSocket $ fromJust client) + let mclient = find (\a -> csUUID a == Just clientId) socks + maybe + (logPrintIO curLevel Warning $ "unknown client: " <> show clientId) + (dropClient curLevel socketList queueList . csSocket) + mclient logPrintIO curLevel Info $ "client has quit the game: " <> show clientId ClientRequestWizard -> do let arena = rcMap readerContainer