summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-12-27 18:58:31 -0800
committerMichael Pavone <pavone@retrodev.com>2016-12-27 18:58:31 -0800
commite2e00fe60bcc9ff0e8f76cf3f9e4ef17113b4519 (patch)
tree03c562b569ae471a47f2319579dc25ced61be211
parent2abec47c2a2598da7cf6c2fdeffcfb6a6277f373 (diff)
Detect failures to initialize a system context and report an error rather than crashing
-rw-r--r--blastem.c6
1 files changed, 6 insertions, 0 deletions
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);