From e2e00fe60bcc9ff0e8f76cf3f9e4ef17113b4519 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 27 Dec 2016 18:58:31 -0800 Subject: Detect failures to initialize a system context and report an error rather than crashing --- blastem.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'blastem.c') diff --git a/blastem.c b/blastem.c index 4c80b91..4b85b03 100644 --- a/blastem.c +++ b/blastem.c @@ -339,6 +339,9 @@ int main(int argc, char ** argv) rom_info info; current_system = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, menu ? 0 : opts, force_region, &info); + if (!current_system) { + fatal_error("Failed to detect system type for %s\n", romfname); + } setup_saves(romfname, &info, current_system); update_title(info.name); if (menu) { @@ -371,6 +374,9 @@ int main(int argc, char ** argv) } //allocate new genesis context game_context = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, opts,force_region, &info); + if (!game_context) { + fatal_error("Failed to detect system type for %s\n", menu_context->next_rom); + } menu_context->next_context = game_context; game_context->next_context = menu_context; setup_saves(menu_context->next_rom, &info, game_context); -- cgit v1.2.3