gnome-games r7962 - trunk/glchess/src/lib/ggz



Author: rancell
Date: Wed Oct  8 03:56:55 2008
New Revision: 7962
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7962&view=rev

Log:
Ignore GGZ server remove player/table for unknown players/tables (Bug #545155)

Modified:
   trunk/glchess/src/lib/ggz/client.py

Modified: trunk/glchess/src/lib/ggz/client.py
==============================================================================
--- trunk/glchess/src/lib/ggz/client.py	(original)
+++ trunk/glchess/src/lib/ggz/client.py	Wed Oct  8 03:56:55 2008
@@ -349,7 +349,12 @@
         self.client.feedback.tableUpdated(table)
 
     def tableRemoved(self, tableId):
-        table = self.client.tables.pop(tableId)
+        try:
+            table = self.client.tables.pop(tableId)
+        except KeyError:
+            # We do not know of this table - this could occur if we receive a
+            # table remove event before we get the table list.
+            return
         self.client.feedback.tableRemoved(table)
         
     def onPlayerList(self, room, players):
@@ -397,7 +402,13 @@
         self.client.feedback.playerAdded(player)
 
     def playerRemoved(self, name, room, toRoom):
-        player = self.client.players.pop(name)
+        try:
+            player = self.client.players.pop(name)
+        except KeyError:
+            # We do not know of this player - this could occur if we receive a
+            # player remove event before we get the player list.
+            return
+            
         player.room.nPlayers -= 1
         player.lastRoom = player.room
         try:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]