Fix crash on loading garbage game file
[xboard.git] / gamelist.c
index d8d0a46..a36af7a 100644 (file)
@@ -304,6 +304,7 @@ int GameListBuild(f)
         case BlackWins:
         case GameIsDrawn:
         case GameUnfinished:
+           if(!currentListGame) break;
            if (currentListGame->gameInfo.resultDetails != NULL) {
                free(currentListGame->gameInfo.resultDetails);
            }
@@ -334,9 +335,9 @@ int GameListBuild(f)
        }
     }
 
+    DisplayTitle("WinBoard");
     rewind(f);
     yyskipmoves = FALSE;
-    DisplayTitle("WinBoard");
     return 0;
 }