diff --git a/CHANGES b/CHANGES index 4995e64d6..8a1fea5cd 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ Bugfixes: - Switch: Fix gyroscope orientation (fixes mgba.io/i/1300) - GBA SIO: Prevent writing read-only multiplayer bits - Qt: Fix color picking in sprite view (fixes mgba.io/i/1307) + - GB: Fix crash when accessing SRAM if no save loaded and cartridge has no SRAM Misc: - GBA Video: Improve sprite cycle counting (fixes mgba.io/i/1274) diff --git a/src/gb/gb.c b/src/gb/gb.c index 508483c1b..038401c83 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -202,7 +202,7 @@ void GBResizeSram(struct GB* gb, size_t size) { if (gb->memory.sram == (void*) -1) { gb->memory.sram = NULL; } - } else { + } else if (size) { uint8_t* newSram = anonymousMemoryMap(size); if (gb->memory.sram) { if (size > gb->sramSize) {