From 70c4c5fada7387f493dfbb3303c1c4bbda38778f Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 12 Jan 2011 11:47:42 +0800 Subject: [PATCH] FTP: Add exception handler to readButton Fix crasher in FTP (see 927184a3f249372c) --- pyfpdb/FulltiltToFpdb.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 955b55b9..761fd669 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -367,7 +367,11 @@ class Fulltilt(HandHistoryConverter): logging.warning(_("No bringin found, handid =%s") % hand.handid) def readButton(self, hand): - hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON')) + try: + hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON')) + except AttributeError, e: + # FTP has no indication that a hand is cancelled. + raise FpdbParseError(_("FTP: readButton: Failed to detect button (hand #%s cancelled?)") % hand.handid) def readHeroCards(self, hand): # streets PREFLOP, PREDRAW, and THIRD are special cases beacause