Просмотр исходного кода

Quac: Fix array out of bounds in create group when empty

Willy-JL 1 год назад
Родитель
Сommit
140bb274d2
1 измененных файлов с 7 добавлено и 2 удалено
  1. 7 2
      quac/scenes/scene_action_create_group.c

+ 7 - 2
quac/scenes/scene_action_create_group.c

@@ -45,9 +45,14 @@ bool scene_action_create_group_on_event(void* context, SceneManagerEvent event)
             if(!strcmp(app->temp_cstr, "")) {
                 return false;
             }
-            Item* item = ItemArray_get(app->items_view->items, app->selected_item);
+
             FuriString* current_path = furi_string_alloc();
-            path_extract_dirname(furi_string_get_cstr(item->path), current_path);
+            if(app->selected_item != EMPTY_ACTION_INDEX) {
+                Item* item = ItemArray_get(app->items_view->items, app->selected_item);
+                path_extract_dirname(furi_string_get_cstr(item->path), current_path);
+            } else {
+                furi_string_set(current_path, app->items_view->path);
+            }
 
             FuriString* new_group_path = furi_string_alloc();
             furi_string_printf(