From c145f41658869eafdaadcb903925ceeae300d49e Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 17 Jun 2025 18:40:06 -0400 Subject: [PATCH] theme_menu: Error out gracefully when a directory doesn't exist Normally we can't browse into a directory that doesn't exist; hwoever the theme menu lets us directly browse (eg) fonts, themes, etc. If the target directory is not present (due to a broken installation) we actually crash! So, um, check and bail gracefully. Should fix FS#13636 Change-Id: Idb28c55cf0ce3954114d056725f9992ceaf1db20 --- apps/menus/theme_menu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index 0c10cd5818..86d3861826 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c @@ -29,6 +29,7 @@ #include "settings.h" #include "rbpaths.h" #include "menu.h" +#include "dir.h" #include "tree.h" #include "list.h" #include "color_picker.h" @@ -42,6 +43,7 @@ #include "viewport.h" #include "statusbar-skinned.h" #include "skin_engine/skin_engine.h" +#include "splash.h" #include "icons.h" #ifdef HAVE_LCD_COLOR #include "filetypes.h" @@ -258,6 +260,11 @@ int browse_folder(void *param) .root = info->dir, }; + if (!dir_exists(info->dir)) { + splash(HZ, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + return GO_TO_PREVIOUS; + } + /* if we are in a special settings folder, center the current setting */ switch(info->show_options) {