Fix crash copying game list when there is none
[xboard.git] / xgamelist.c
index d2cf8bd..8839e90 100644 (file)
@@ -623,7 +623,7 @@ int SaveGameListAsText(FILE *f)
     ListGame * lg = (ListGame *) gameList.head;\r
     int nItem;\r
 \r
-    if( ((ListGame *) gameList.tailPred)->number <= 0 ) {\r
+    if( !glc || ((ListGame *) gameList.tailPred)->number <= 0 ) {\r
         DisplayError("Game list not loaded or empty", 0);\r
         return False;\r
     }\r