all repos — mgba @ 2bca4c399bda1e630b23ac6cefc56dfb588774e2

mGBA Game Boy Advance Emulator

Fix assumption that savedata->vf is non-null within flash memory code
Jeffrey Pfau jeffrey@endrift.com
Sat, 11 Oct 2014 15:46:59 -0700
commit

2bca4c399bda1e630b23ac6cefc56dfb588774e2

parent

d87081e6bc583f676d5903f91ae1ce0763acca9f

1 files changed, 3 insertions(+), 1 deletions(-)

jump to
M src/gba/gba-savedata.csrc/gba/gba-savedata.c

@@ -343,7 +343,9 @@ void _flashSwitchBank(struct GBASavedata* savedata, int bank) {

savedata->currentBank = &savedata->data[bank << 16]; if (bank > 0) { savedata->type = SAVEDATA_FLASH1M; - savedata->vf->truncate(savedata->vf, SIZE_CART_FLASH1M); + if (savedata->vf) { + savedata->vf->truncate(savedata->vf, SIZE_CART_FLASH1M); + } } }