Fix crashers
authorunc0rr
Wed, 23 Jan 2013 23:54:01 +0400
changeset 8428 73ab5a17ee55
parent 8427 95289aea4bb9
child 8429 f814a7c2a318
Fix crashers
gameServer/CoreTypes.hs
gameServer/HWProtoInRoomState.hs
--- a/gameServer/CoreTypes.hs	Wed Jan 23 04:48:04 2013 +0100
+++ b/gameServer/CoreTypes.hs	Wed Jan 23 23:54:01 2013 +0400
@@ -73,7 +73,7 @@
         leftTeams :: [B.ByteString],
         teamsAtStart :: [TeamInfo],
         teamsInGameNumber :: Int,
-        allPlayersHaveRegisteredAccounts :: Bool,
+        allPlayersHaveRegisteredAccounts :: !Bool,
         giMapParams :: Map.Map B.ByteString B.ByteString,
         giParams :: Map.Map B.ByteString [B.ByteString]
     } deriving (Show, Read)
--- a/gameServer/HWProtoInRoomState.hs	Wed Jan 23 04:48:04 2013 +0100
+++ b/gameServer/HWProtoInRoomState.hs	Wed Jan 23 23:54:01 2013 +0400
@@ -103,7 +103,7 @@
         let team = fromJust maybeTeam
 
         return $
-            if isNothing $ findTeam r then
+            if isNothing $ maybeTeam then
                 [Warning $ loc "REMOVE_TEAM: no such team"]
             else if clNick /= teamowner team then
                 [ProtocolError $ loc "Not team owner!"]
@@ -132,7 +132,9 @@
     return $
         if not $ isMaster cl then
             [ProtocolError $ loc "Not room master"]
-        else if hhNumber < 1 || hhNumber > 8 || isNothing maybeTeam || hhNumber > canAddNumber r + hhnum team then
+        else if isNothing maybeTeam
+            return []
+        else if hhNumber < 1 || hhNumber > 8 || hhNumber > canAddNumber r + hhnum team then
             [AnswerClients clChan ["HH_NUM", teamName, showB $ hhnum team]]
         else
             [ModifyRoom $ modifyTeam team{hhnum = hhNumber},