From aeb9da337e506cae3548b23b507ddb89c5975014 Mon Sep 17 00:00:00 2001 From: tertu Date: Sat, 10 Aug 2024 06:33:05 -0500 Subject: [PATCH] Add some null pointer checks (#5130) * Fix some null pointer uses * fix bad merge --- src/pokemon_storage_system.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index fe65df0114..6c9c53fd7f 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -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); + } } }