diff searching.c @ 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 fef53ca48541
children d8ec83537d07
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;
     }