From c673c282744e4bbbfc37ba52d1a1d6493c7b5a44 Mon Sep 17 00:00:00 2001 From: ToadKing Date: Mon, 20 May 2013 22:19:10 -0400 Subject: [PATCH] (GX) fix crash on empty argv --- frontend/platform/platform_gx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/platform/platform_gx.c b/frontend/platform/platform_gx.c index d9b4887610..95c29af555 100644 --- a/frontend/platform/platform_gx.c +++ b/frontend/platform/platform_gx.c @@ -345,7 +345,7 @@ static int system_process_args(int argc, char *argv[]) // a big hack: sometimes salamander doesn't save the new core it loads on first boot, // so we make sure g_settings.libretro is set here - if (!g_settings.libretro[0] && strrchr(argv[0], '/')) + if (!g_settings.libretro[0] && argc >= 1 && strrchr(argv[0], '/')) strlcpy(g_settings.libretro, strrchr(argv[0], '/') + 1, sizeof(g_settings.libretro)); if (argc > 2 && argv[1] != NULL && argv[2] != NULL)