Art Attack - Patch for crash on connection

A couple of people have reported crashes on connecting to a game.


File "artattack/game.py", line 213, in handle_tool_move
    world.players[playerid].set_tool_position(pos)
AttributeError: 'NoneType' object has no attribute 'players'
This is caused by moving the cursor on the host before the client has fully initialised the session, and should be fixed by this patch:
 

diff -r 9609fce284e1 artattack/game.py
--- a/artattack/game.py    Sun Apr 10 22:40:22 2011 +0100
+++ b/artattack/game.py    Mon Apr 11 23:22:20 2011 +0100
@@ -259,8 +259,9 @@
         pc.attack()
 
     def on_key(self, event):
-        for k in self.keycontrollers:
-            k.on_key_down(event)
+        if self.started:
+            for k in self.keycontrollers:
+                k.on_key_down(event)

Exceptions reported as coming from "Thread-2" can be ignored, as can messages about unhandled opcodes.