From f6801f8d6a93615c817f069d0ae7ba12075b420e Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 30 Oct 2014 18:32:07 +0000 Subject: [PATCH] handle the case when there are zero connected players --- squeeze.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/squeeze.el b/squeeze.el index 2549159..cfbca13 100644 --- a/squeeze.el +++ b/squeeze.el @@ -394,12 +394,13 @@ (let ((count (squeeze-parse-count string)) (startpos (string-match "playerindex" string)) result endpos) - (dotimes (i (1- count)) - (setq endpos (progn (string-match " connected%3A[0-1] " string startpos) - (match-end 0))) - (push (apply 'squeeze-make-player (squeeze-string-plistify string startpos endpos)) result) - (setq startpos endpos)) - (push (apply 'squeeze-make-player (squeeze-string-plistify string startpos (length string))) result) + (when (> count 0) + (dotimes (i (1- count)) + (setq endpos (progn (string-match " connected%3A[0-1] " string startpos) + (match-end 0))) + (push (apply 'squeeze-make-player (squeeze-string-plistify string startpos endpos)) result) + (setq startpos endpos)) + (push (apply 'squeeze-make-player (squeeze-string-plistify string startpos (length string))) result)) result)) -- 2.30.2