1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Check for SDL_strdup failure in parseComments

Just in case it happens. Comments aren't really important to the game
(at worst a track will just loop in the wrong place) so it's fine to
carry on here and ignore all comments if this happens.
This commit is contained in:
Misa 2022-11-13 19:41:32 -08:00
parent 27e04e9dbf
commit fb13e652fa

View file

@ -484,6 +484,14 @@ end:
for (int i = 0; i < comment_list_length; i++) for (int i = 0; i < comment_list_length; i++)
{ {
char* param = SDL_strdup(comments[i]); char* param = SDL_strdup(comments[i]);
if (param == NULL)
{
vlog_error(
"Could not allocate memory to parse '%s'. Ignoring comments.",
comments[i]
);
break;
}
char* argument = param; char* argument = param;
char* value = SDL_strchr(param, '='); char* value = SDL_strchr(param, '=');
if (value == NULL) if (value == NULL)