From b96d365968ad7f5d11c24f2df2bd2ea99f7cca9d Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Wed, 23 Mar 2016 00:46:15 +0100 Subject: [PATCH] Only set CORE_TYPE_PLAIN for non-directory -L. Fixes crash on Android startup which uses -L CLI argument. -L can also set core directory, even though it's not supposed to be used anymore. Also, on Android, the cores directory might not be populated, so ignore arguments which are not valid. --- retroarch.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/retroarch.c b/retroarch.c index 874f00a972..6053de552c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -829,14 +829,20 @@ static void parse_input(int argc, char *argv[]) "Setting libretro_directory to \"%s\" instead.\n", optarg); } - else + else if (path_file_exists(optarg)) { runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, optarg); global->has_set.libretro = true; + + /* We requested explicit core, so use PLAIN core type. */ + current_core_type = CORE_TYPE_PLAIN; + } + else + { + RARCH_WARN("--libretro argument \"%s\" is neither a file nor directory. Ignoring.\n", + optarg); } - /* We requested explicit core, so use PLAIN core type. */ - current_core_type = CORE_TYPE_PLAIN; break; #endif case 'P':