Fix crash when rgui->info.library_name is NULL.

If retroarch was started with g_settings.libretro as a directory, and a
ROM loaded. Going into RGUI would see g_settings.libretro as a directory
and rgui->info wouldn't be properly initialized.

Fixed by updating g_settings.libretro if a specific core is resolved.
This commit is contained in:
Themaister 2013-05-04 14:32:00 +02:00
parent a01defd01b
commit 13f0a8548f
2 changed files with 9 additions and 8 deletions

View File

@ -277,11 +277,9 @@ static void load_symbols(bool is_dummy)
else else
{ {
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
const char *libretro_path = g_settings.libretro;
char libretro_core_buffer[PATH_MAX];
if (path_is_directory(g_settings.libretro)) if (path_is_directory(g_settings.libretro))
{ {
char libretro_core_buffer[PATH_MAX];
if (!find_first_libretro(libretro_core_buffer, sizeof(libretro_core_buffer), if (!find_first_libretro(libretro_core_buffer, sizeof(libretro_core_buffer),
g_settings.libretro, g_extern.fullpath)) g_settings.libretro, g_extern.fullpath))
{ {
@ -289,14 +287,14 @@ static void load_symbols(bool is_dummy)
rarch_fail(1, "load_dynamic()"); rarch_fail(1, "load_dynamic()");
} }
libretro_path = libretro_core_buffer; strlcpy(g_settings.libretro, libretro_core_buffer, sizeof(g_settings.libretro));
} }
RARCH_LOG("Loading dynamic libretro from: \"%s\"\n", libretro_path); RARCH_LOG("Loading dynamic libretro from: \"%s\"\n", g_settings.libretro);
lib_handle = dylib_load(libretro_path); lib_handle = dylib_load(g_settings.libretro);
if (!lib_handle) if (!lib_handle)
{ {
RARCH_ERR("Failed to open dynamic library: \"%s\"\n", libretro_path); RARCH_ERR("Failed to open dynamic library: \"%s\"\n", g_settings.libretro);
rarch_fail(1, "load_dynamic()"); rarch_fail(1, "load_dynamic()");
} }
#endif #endif

View File

@ -379,9 +379,12 @@ void load_menu_game_prepare(void)
} }
if (rgui->history) if (rgui->history)
{
rom_history_push(rgui->history, rom_history_push(rgui->history,
*g_extern.fullpath ? g_extern.fullpath : NULL, *g_extern.fullpath ? g_extern.fullpath : NULL,
g_settings.libretro, rgui->info.library_name); g_settings.libretro,
rgui->info.library_name);
}
} }
#ifdef HAVE_RGUI #ifdef HAVE_RGUI