mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-10 19:01:50 +00:00
More NULL handling for gamedata
Partial duplicate of MR 1010, but 1) wanted to guarantee no merge conflicts before I forgot and 2) I added things in previous commits which needed stronger guarding
This commit is contained in:
parent
1f144c3106
commit
db52c22a83
4 changed files with 11 additions and 5 deletions
|
|
@ -977,7 +977,7 @@ void D_ClearState(void)
|
||||||
|
|
||||||
cursongcredit.def = NULL;
|
cursongcredit.def = NULL;
|
||||||
|
|
||||||
if (gamedata->deferredsave)
|
if (gamedata && gamedata->deferredsave)
|
||||||
G_SaveGameData(true);
|
G_SaveGameData(true);
|
||||||
|
|
||||||
G_SetGamestate(GS_NULL);
|
G_SetGamestate(GS_NULL);
|
||||||
|
|
|
||||||
|
|
@ -4558,11 +4558,11 @@ void G_SaveGameData(boolean dirty)
|
||||||
UINT8 btemp;
|
UINT8 btemp;
|
||||||
savebuffer_t save = {0};
|
savebuffer_t save = {0};
|
||||||
|
|
||||||
gamedata->deferredsave = false;
|
if (gamedata == NULL || !gamedata->loaded)
|
||||||
|
|
||||||
if (!gamedata->loaded)
|
|
||||||
return; // If never loaded (-nodata), don't save
|
return; // If never loaded (-nodata), don't save
|
||||||
|
|
||||||
|
gamedata->deferredsave = false;
|
||||||
|
|
||||||
if (usedCheats)
|
if (usedCheats)
|
||||||
{
|
{
|
||||||
#ifdef DEVELOP
|
#ifdef DEVELOP
|
||||||
|
|
|
||||||
|
|
@ -1090,6 +1090,12 @@ boolean M_UpdateUnlockablesAndExtraEmblems(boolean loud)
|
||||||
INT32 i;
|
INT32 i;
|
||||||
UINT8 response = 0;
|
UINT8 response = 0;
|
||||||
|
|
||||||
|
if (!gamedata)
|
||||||
|
{
|
||||||
|
// Don't attempt to write/check anything.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!loud)
|
if (!loud)
|
||||||
{
|
{
|
||||||
// Just in case they aren't to sync
|
// Just in case they aren't to sync
|
||||||
|
|
|
||||||
|
|
@ -633,7 +633,7 @@ void P_Ticker(boolean run)
|
||||||
|
|
||||||
// TODO would this be laggy with more conditions in play...
|
// TODO would this be laggy with more conditions in play...
|
||||||
if ((!demo.playback && M_UpdateUnlockablesAndExtraEmblems(true))
|
if ((!demo.playback && M_UpdateUnlockablesAndExtraEmblems(true))
|
||||||
|| gamedata->deferredsave)
|
|| (gamedata && gamedata->deferredsave))
|
||||||
G_SaveGameData(true);
|
G_SaveGameData(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue