Aleks31 / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

IndexError upon being checkmated in FICS game #876

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I was playing a FICS game and got checkmated and then got the following 
exception. I didn't notice until later on, so the exception is not at the end 
of the log file attached.

Traceback (most recent call last):
  File "/home/gatto/code/hg/pychess/lib/pychess/widgets/gamewidget.py", line 285, in shown_changed
    self.clock.update(wmovecount, bmovecount)
  File "/home/gatto/code/hg/pychess/lib/pychess/widgets/ChessClock.py", line 183, in update
    bt = formatTime (self.model.getPlayerTime(BLACK, bmovecount))
  File "/home/gatto/code/hg/pychess/lib/pychess/Utils/TimeModel.py", line 224, in getPlayerTime
    return self.intervals[color][movecount]
IndexError: list index out of range

Original issue reported on code.google.com by mattgatto on 29 May 2014 at 6:27

Attachments:

GoogleCodeExporter commented 8 years ago
The log shows that the game end info from helper connection was coming before 
the latest (mating) move style12 message. So the time model's tap() was not 
called from game model, or did nothing, koz it was paused (koz game ended 
before), and the latest move time interval was not appended. I have no idea how 
to solve this in elegant way.

Original comment by gbtami on 29 May 2014 at 7:55

GoogleCodeExporter commented 8 years ago
Maybe something like, even if were paused in tap(), we compare the gamemodel 
last ply with our own in self.intervals and if it's higher, we append to 
self.intervals?

Original comment by mattgatto on 29 May 2014 at 8:30

GoogleCodeExporter commented 8 years ago
Along with or otherwise catching IndexError in getPlayerTime and logging a 
warning instead of raising an exception.

Original comment by mattgatto on 29 May 2014 at 8:31

GoogleCodeExporter commented 8 years ago
This issue was closed by revision dd645dff16ee.

Original comment by gbtami on 30 May 2014 at 3:07