diff --git a/Core/display.c b/Core/display.c index 356e742..67a9fc4 100644 --- a/Core/display.c +++ b/Core/display.c @@ -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]; diff --git a/Core/gb.c b/Core/gb.c index 75538e1..3b834dd 100644 --- a/Core/gb.c +++ b/Core/gb.c @@ -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);