summaryrefslogtreecommitdiff
path: root/chess-ics.el
diff options
context:
space:
mode:
Diffstat (limited to 'chess-ics.el')
-rw-r--r--chess-ics.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/chess-ics.el b/chess-ics.el
index 4cc69a7..5b90b19 100644
--- a/chess-ics.el
+++ b/chess-ics.el
@@ -211,15 +211,16 @@ who is black."
(setq parts (cdr parts))
;; checkmate, etc., is stated in the SAN text
- (cond
- ((= ?+ (aref move (1- (length move))))
- (chess-pos-set-status position :check))
- ((= ?# (aref move (1- (length move))))
- (chess-pos-set-status position :checkmate))
- (nil
- ;; jww (2002-04-30): what about stalemate? do I need to
- ;; calculate this each time?
- (chess-pos-set-status position :stalemate)))
+ (when (> (length move) 0)
+ (cond
+ ((= ?+ (aref move (1- (length move))))
+ (chess-pos-set-status position :check))
+ ((= ?# (aref move (1- (length move))))
+ (chess-pos-set-status position :checkmate))
+ (nil
+ ;; jww (2002-04-30): what about stalemate? do I need to
+ ;; calculate this each time?
+ (chess-pos-set-status position :stalemate))))
;; flip field for board orientation: 1 = Black at bottom, 0 =
;; White at bottom.