src/main.c

changeset 138
bcd6100373ef
parent 133
c58ae152733e
equal deleted inserted replaced
137:43d1b3c33369 138:bcd6100373ef
898 long position = ftell(pgnfile); 898 long position = ftell(pgnfile);
899 fclose(pgnfile); 899 fclose(pgnfile);
900 if (result) { 900 if (result) {
901 printw("Invalid PGN file content at position %ld:\n%s\n", 901 printw("Invalid PGN file content at position %ld:\n%s\n",
902 position, pgn_error_str(result)); 902 position, pgn_error_str(result));
903 gamestate_cleanup(&gamestate);
903 return; 904 return;
904 } 905 }
905 if (!is_game_running(&gamestate)) { 906 if (!is_game_running(&gamestate)) {
906 addstr("Game has ended. Use -S to analyze it.\n"); 907 addstr("Game has ended. Use -S to analyze it.\n");
908 gamestate_cleanup(&gamestate);
907 return; 909 return;
908 } 910 }
909 curcol = current_color(&gamestate); 911 curcol = current_color(&gamestate);
910 } else { 912 } else {
911 printw("Can't read PGN file (%s)\n", strerror(errno)); 913 printw("Can't read PGN file (%s)\n", strerror(errno));
914 gamestate_cleanup(&gamestate);
912 return; 915 return;
913 } 916 }
914 } 917 }
915 918
916 bool running; 919 bool running;

mercurial