Fix selected item when item deleted
@@ -181,6 +181,10 @@ void load_file_list(std::string directory) {
}
}
+ auto total_items = game_list.size();
+ if(persist.selected_menu_item >= total_items)
+ persist.selected_menu_item = total_items - 1;
+
sort_file_list();
}
@@ -210,10 +214,6 @@ void init_lists() {
load_file_list(current_directory->name);
- auto total_items = game_list.size();
- if(persist.selected_menu_item >= total_items)
- persist.selected_menu_item = total_items - 1;
-
load_current_game_metadata();
}
