From 11f1d566c939e9a9e672e4b75b19ba571ac30bb2 Mon Sep 17 00:00:00 2001 From: pyroesp Date: Tue, 20 Oct 2015 17:20:56 +0200 Subject: [PATCH] Added file check before loading game. --- retroarch.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/retroarch.c b/retroarch.c index e1ca9ef244..3faa5e92db 100644 --- a/retroarch.c +++ b/retroarch.c @@ -46,6 +46,7 @@ #include "performance.h" #include "cheats.h" #include "system.h" +#include "retro_file.h" #include "git_version.h" @@ -1495,6 +1496,15 @@ void rarch_playlist_load_content(void *data, unsigned idx) content_playlist_get_index(playlist, idx, &path, NULL, &core_path, NULL, NULL, NULL); + RFILE *fp = retro_fopen(path, RFILE_MODE_READ, -1); + if (!fp) + { + rarch_main_msg_queue_push("File could not be loaded.\n", 1, 100, true); + RARCH_LOG("File at %s failed to load.\n", path); + return; + } + retro_fclose(fp); + strlcpy(settings->libretro, core_path, sizeof(settings->libretro)); if (menu)