fowode / pychess

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

Invalid FEN strings shouldn't crash pychess #829

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Load an invalid FEN string. For example, a file with just 
"8/q6k/q6p/pR3Np1/P3P3/6P1/1Q3P1P/6K1" in it.

What is the expected output? What do you see instead?
pychess should probably display a warning dialog giving an error message. 
Instead it crashes:
Traceback (most recent call last):
  File "/home/gatto/code/hg/pychess/lib/pychess/widgets/BoardPreview.py", line 123, in on_selection_changed
    self.chessfile.loadToModel(sel, -1, self.gamemodel)
  File "/home/gatto/code/hg/pychess/lib/pychess/Savers/fen.py", line 32, in loadToModel
    model.boards = [model.variant.board(setup=fen)]
  File "/home/gatto/code/hg/pychess/lib/pychess/Utils/Board.py", line 41, in __init__
    self.board.applyFen(setup)
  File "/home/gatto/code/hg/pychess/lib/pychess/Utils/lutils/LBoard.py", line 139, in applyFen
    len(fenstr)
SyntaxError: Needs at least 6 fields in fenstr. Pos(36)

Original issue reported on code.google.com by mattgatto on 22 Jan 2014 at 2:47

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

Original comment by gbtami on 25 Jan 2014 at 10:21