# HG changeset patch # User Michael Pavone # Date 1604802454 28800 # Node ID 8e7b06ade815185d9213538bee68b8afe94b4ba6 # Parent 2d8748e0ccb23b071282a032ea454c7431e3f4d4 Prevent user from getting stuck in directories they don't have permission to read in ROM browser diff -r 2d8748e0ccb2 -r 8e7b06ade815 nuklear_ui/blastem_nuklear.c --- a/nuklear_ui/blastem_nuklear.c Sat Nov 07 14:19:02 2020 -0800 +++ b/nuklear_ui/blastem_nuklear.c Sat Nov 07 18:27:34 2020 -0800 @@ -88,6 +88,15 @@ if (entries) { sort_dir_list(entries, num_entries); } + if (!num_entries) { + //get_dir_list can fail if the user doesn't have permission + //for the current folder, make sure they can still navigate up + free_dir_list(entries, num_entries); + entries = calloc(1, sizeof(dir_entry)); + entries[0].name = strdup(".."); + entries[0].is_dir = 1; + num_entries = 1; + } } if (!got_ext_list) { ext_list = get_extension_list(config, &num_exts);