PR_SaveProfiles: Do not attempt to save if Guest profile data hasn't been initialised yet.

- This only happens at the very end of PR_LoadProfiles, so it marks the clear point data is good.
- Resolves #451
This commit is contained in:
toaster 2023-02-25 14:42:40 +00:00
parent afbea1ccc4
commit e87d4b88ec

View file

@ -219,6 +219,12 @@ void PR_SaveProfiles(void)
UINT8 i, j, k;
savebuffer_t save = {0};
if (profilesList[PROFILE_GUEST] == NULL)
{
// Profiles have not been loaded yet, don't overwrite with garbage.
return;
}
if (P_SaveBufferAlloc(&save, sizeof(UINT32) + (numprofiles * sizeof(profile_t))) == false)
{
I_Error("No more free memory for saving profiles\n");