From 6d5939063cfc6fac4c0f0d70d70d821e298cf2e3 Mon Sep 17 00:00:00 2001
From: twinaphex <libretro@gmail.com>
Date: Wed, 11 Feb 2015 01:41:30 +0100
Subject: [PATCH] Add early return in case cheat directory or remap file
 doesn't exist

---
 menu/menu_entries_cbs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c
index 39f1e058b7..dc557921cd 100644
--- a/menu/menu_entries_cbs.c
+++ b/menu/menu_entries_cbs.c
@@ -402,6 +402,12 @@ static int action_ok_configurations_list(const char *path,
 static int action_ok_cheat_file(const char *path,
       const char *label, unsigned type, size_t idx)
 {
+   if (!path_file_exists(g_settings.cheat_database))
+   {
+      msg_queue_clear(g_extern.msg_queue);
+      msg_queue_push(g_extern.msg_queue, "Cheat Directory doesn't exist or cannot be accessed.\n", 1, 180);
+      return -1;
+   }
    return menu_list_push_stack_refresh(
          driver.menu->menu_list,
          g_settings.cheat_database,
@@ -411,6 +417,12 @@ static int action_ok_cheat_file(const char *path,
 static int action_ok_remap_file(const char *path,
       const char *label, unsigned type, size_t idx)
 {
+   if (!path_file_exists(g_settings.input_remapping_directory))
+   {
+      msg_queue_clear(g_extern.msg_queue);
+      msg_queue_push(g_extern.msg_queue, "Remapping Directory doesn't exist or cannot be accessed.\n", 1, 180);
+      return -1;
+   }
    return menu_list_push_stack_refresh(
          driver.menu->menu_list,
          g_settings.input_remapping_directory,