Fix crash at match end
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 2 Jan 2012 22:46:18 +0000 (23:46 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Tue, 3 Jan 2012 20:37:56 +0000 (21:37 +0100)
The -afterTourney option had broken old-style matches, because the ranking
string that was tested for "busy" is not set there at all, and remains a
NULL pointer, which strcmp doesn't like.

backend.c

index f59096c..a3b0f0c 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -10492,7 +10492,7 @@ GameEnds(result, resultDetails, whosays)
                     first.matchWins, second.matchWins,
                     appData.matchGames - (first.matchWins + second.matchWins));
            if(!appData.tourneyFile[0]) matchGame++, DisplayTwoMachinesTitle(); // [HGM] update result in window title
-           if(strcmp(ranking, "busy") && appData.afterTourney && appData.afterTourney[0]) RunCommand(appData.afterTourney);
+           if(ranking && strcmp(ranking, "busy") && appData.afterTourney && appData.afterTourney[0]) RunCommand(appData.afterTourney);
            popupRequested++; // [HGM] crash: postpone to after resetting endingGame
            if (appData.firstPlaysBlack) { // [HGM] match: back to original for next match
                first.twoMachinesColor = "black\n";