From 65e6ab5b8b3807f98c7cc81adafd81a9d97ee21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Tue, 16 Nov 2021 17:10:06 +0300 Subject: [PATCH] [FL-2017] Gui: correct empty folder handling in file_select. #824 --- applications/gui/modules/file_select.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/applications/gui/modules/file_select.c b/applications/gui/modules/file_select.c index 4007fd95..449f3194 100644 --- a/applications/gui/modules/file_select.c +++ b/applications/gui/modules/file_select.c @@ -142,9 +142,11 @@ static bool file_select_input_callback(InputEvent* event, void* context) { } } else if(event->key == InputKeyOk) { if(file_select->callback != NULL) { + size_t files = 0; if(file_select->buffer) { with_view_model( file_select->view, (FileSelectModel * model) { + files = model->file_count; strlcpy( file_select->buffer, string_get_cstr(model->filename[model->position]), @@ -153,8 +155,9 @@ static bool file_select_input_callback(InputEvent* event, void* context) { return false; }); }; - - file_select->callback(true, file_select->context); + if(files > 0) { + file_select->callback(true, file_select->context); + } } consumed = true; }