Skip to content

Commit

Permalink
add check for file validity
Browse files Browse the repository at this point in the history
only parse file if header present
Factorio borks file creation sometimes, don't know why
  • Loading branch information
alifeee committed Sep 25, 2023
1 parent 10f08fc commit a858d50
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mumble/logfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ int parse_factorio_logfile(float *x, float *y, float *z, int *player, int *surfa
return 0;
}
// process data

// check XYZ is present
// IMPORTANT: otherwise, the file is invalid somehow (thanks Lua)
// and Mumble will crash when trying to parse it
if (strstr(f_data, "XYZ") == NULL)
{
*error = 4;
return 0;
}
// printf("%s\n", f_data);
// split by newline
char *line;
Expand Down

0 comments on commit a858d50

Please sign in to comment.