Don't crash if a naughty frontend runs the boot ROM without a ROM
This commit is contained in:
parent
0abd3b2c46
commit
695c6ee943
@ -165,7 +165,7 @@ static void display_vblank(GB_gameboy_t *gb)
|
||||
0x30DA, 0x69AD, 0x2B57, 0x2B5D, 0x632C,
|
||||
0x1050, 0x3C84, 0x0E07, 0x0E18, 0x2964,
|
||||
};
|
||||
unsigned index = gb->rom[0x14e] % 5;
|
||||
unsigned index = gb->rom? gb->rom[0x14e] % 5 : 0;
|
||||
gb->borrowed_border.palette[0] = colors[index];
|
||||
gb->borrowed_border.palette[10] = colors[5 + index];
|
||||
gb->borrowed_border.palette[14] = colors[10 + index];
|
||||
|
@ -230,7 +230,7 @@ void GB_borrow_sgb_border(GB_gameboy_t *gb)
|
||||
if (gb->border_mode != GB_BORDER_ALWAYS) return;
|
||||
if (gb->tried_loading_sgb_border) return;
|
||||
gb->tried_loading_sgb_border = true;
|
||||
if (gb->rom[0x146] != 3) return; // Not an SGB game, nothing to borrow
|
||||
if (gb->rom && gb->rom[0x146] != 3) return; // Not an SGB game, nothing to borrow
|
||||
if (!gb->boot_rom_load_callback) return; // Can't borrow a border without this callback
|
||||
GB_gameboy_t sgb;
|
||||
GB_init(&sgb, GB_MODEL_SGB);
|
||||
|
Loading…
Reference in New Issue
Block a user