Add some error checking
This commit is contained in:
parent
bcdd131be7
commit
01e64ec05f
|
@ -99,6 +99,9 @@ class Goban:
|
|||
def set_hover(self, pos):
|
||||
realpos = _real_pos(pos)
|
||||
|
||||
if _i(realpos) < 0 or _i(realpos) > 18 or _j(realpos) < 0 or _j(realpos) > 18:
|
||||
return
|
||||
|
||||
if self.hover == realpos:
|
||||
return
|
||||
|
||||
|
@ -136,7 +139,7 @@ class Goban:
|
|||
board = p.in_dll(Goban.libboard, 'board')
|
||||
|
||||
for pos in range(421):
|
||||
if _i(pos) < 0 or _j(pos) < 0:
|
||||
if _i(pos) < 0 or _i(pos) > 18 or _j(pos) < 0 or _j(pos) > 18:
|
||||
continue
|
||||
|
||||
code = self._get_draw_code(pos, board[pos])
|
||||
|
|
Loading…
Reference in New Issue
Block a user