Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-09-03 14:17:52 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-09-03 14:17:52 (GMT)
commit83532aa6f2ac611d9f7e07c741ce4beb1dcba1b3 (patch)
treeb278ed32dc5afaa31fbf614a1fb6ad159b4d0812
parent5750131ed36306b65a896c4b3b883deced96a91a (diff)
don't load bad boards
-rw-r--r--chess.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/chess.py b/chess.py
index e523d48..75cbf91 100644
--- a/chess.py
+++ b/chess.py
@@ -243,7 +243,7 @@ class Gnuchess():
while find(output, target) > 0:
output = output[find(output, target):]
output = output[find(output, '\n'):]
- if len(output) < 136:
+ if len(output) < 136 or output[0:3] == 'GNU':
self._activity.status.set_label('???')
else:
self._load_board(output)
@@ -468,6 +468,9 @@ class Gnuchess():
# Get game notation from last move to share and to check for
# check, checkmate
self.move(GAME)
+ if self.game == '':
+ _logger.debug('bad move: reseting')
+ return True
last_move = self.game.split()[-1]
if self.we_are_sharing:
self._activity.send_event('m|%s' % (last_move))