# HG changeset patch # User Michael Pavone # Date 1482893911 28800 # Node ID 093c19f34dfd881ef9f2b5f3bd84e13a8458161b # Parent cb4771f4543a33baadfde1dafa93fc0e04584384 Detect failures to initialize a system context and report an error rather than crashing diff -r cb4771f4543a -r 093c19f34dfd blastem.c --- a/blastem.c Tue Dec 27 14:31:27 2016 -0800 +++ b/blastem.c Tue Dec 27 18:58:31 2016 -0800 @@ -339,6 +339,9 @@ 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 @@ } //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);