From f71c00112aaabe970bb7421fa74ae1f9656b7835 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 11 Feb 2015 01:43:16 +0100 Subject: [PATCH] Add early return in case database/cursor directory has not been set or is inaccessible --- menu/menu_entries_cbs.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index dc557921cd..a63a212c69 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -1237,6 +1237,14 @@ static int action_ok_database_manager_list(const char *path, fill_pathname_join(rdb_path, g_settings.content_database, path, sizeof(rdb_path)); + if (!path_file_exists(rdb_path)) + { + msg_queue_clear(g_extern.msg_queue); + msg_queue_push(g_extern.msg_queue, + "Database Directory doesn't exist or cannot be accessed.\n", + 1, 180); + return -1; + } return menu_list_push_stack_refresh( driver.menu->menu_list, rdb_path, @@ -1252,6 +1260,14 @@ static int action_ok_cursor_manager_list(const char *path, fill_pathname_join(cursor_path, g_settings.cursor_directory, path, sizeof(cursor_path)); + if (!path_file_exists(cursor_path)) + { + msg_queue_clear(g_extern.msg_queue); + msg_queue_push(g_extern.msg_queue, + "Cursor Directory doesn't exist or cannot be accessed.\n", + 1, 180); + return -1; + } return menu_list_push_stack_refresh( driver.menu->menu_list, cursor_path,