Add some null pointer checks (#5130)

* Fix some null pointer uses

* fix bad merge
This commit is contained in:
tertu 2024-08-10 06:33:05 -05:00 committed by GitHub
parent 113f8de9b1
commit aeb9da337e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1998,7 +1998,10 @@ static void VBlankCB_PokeStorage(void)
ProcessSpriteCopyRequests();
UnkUtil_Run();
TransferPlttBuffer();
SetGpuReg(REG_OFFSET_BG2HOFS, sStorage->bg2_X);
if (sStorage != NULL)
{
SetGpuReg(REG_OFFSET_BG2HOFS, sStorage->bg2_X);
}
}
static void CB2_PokeStorage(void)
@ -4206,11 +4209,14 @@ static void StopFlashingCloseBoxButton(void)
static void UpdateCloseBoxButtonFlash(void)
{
if (sStorage->closeBoxFlashing && ++sStorage->closeBoxFlashTimer > 30)
if (sStorage != NULL)
{
sStorage->closeBoxFlashTimer = 0;
sStorage->closeBoxFlashState = (sStorage->closeBoxFlashState == FALSE);
UpdateCloseBoxButtonTilemap(sStorage->closeBoxFlashState);
if (sStorage->closeBoxFlashing && ++sStorage->closeBoxFlashTimer > 30)
{
sStorage->closeBoxFlashTimer = 0;
sStorage->closeBoxFlashState = (sStorage->closeBoxFlashState == FALSE);
UpdateCloseBoxButtonTilemap(sStorage->closeBoxFlashState);
}
}
}