GB: Fix crash when accessing SRAM if no save loaded and cartridge has no SRAM

This commit is contained in:
Vicki Pfau 2019-02-20 19:44:11 -08:00
parent f00b7fcf55
commit 3a8ff86d6b
2 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,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 Savedata: EEPROM performance fixes
- GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash

View File

@ -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) {