changeset 436:a566d307173d src

Avoid a crash when program number is zero. This is a workaround for a crash at: cellnr = pgc->program_map[ptt[i].pgn-1]; when playing "The Dictator". Based on a patch by Ivan Kalvachev < ikalvachev AT gmail DOT com>.
author rathann
date Mon, 11 Nov 2013 23:49:17 +0000
parents 29d4a43c8c86
children d8ec83537d07
files searching.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/searching.c	Sun Nov 10 11:38:58 2013 +0000
+++ b/searching.c	Mon Nov 11 23:49:17 2013 +0000
@@ -629,7 +629,7 @@
       printerr("Program map missing.");
       continue;
     }
-    if(ptt[i].pgn > pgc->nr_of_programs) {
+    if(ptt[i].pgn == 0 || ptt[i].pgn > pgc->nr_of_programs) {
       printerr("WRONG part number.");
       goto fail;
     }