We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8de4293 commit 29e5021Copy full SHA for 29e5021
game.c
@@ -242,12 +242,14 @@ setup_game( const char *file_name, int *side_to_move ) {
242
break;
243
default:
244
#if TEXT_BASED
245
- printf( "%s '%c' %s\n", BAD_CHARACTER_ERROR, buffer[pos],
+ if (buffer[token] != '\0') // Don't log if string ended
246
+ printf( "%s '%c' %s\n", BAD_CHARACTER_ERROR, buffer[token],
247
GAME_FILE_TEXT);
248
#endif
249
250
}
- token++;
251
+ if (buffer[token] != '\0') // Don't increment if string ended
252
+ token++;
253
254
255
fgets( buffer, 10, stream );
0 commit comments