Skip to content

Commit

Permalink
Archive: fix null dereference #1531 (#1532)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrZlo13 authored Aug 4, 2022
1 parent 4c499d9 commit 4460010
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions applications/archive/scenes/archive_scene_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
ArchiveBrowserView* browser = archive->browser;
ArchiveFile_t* selected = archive_get_current_file(browser);

const char* name = archive_get_name(browser);
bool known_app = archive_is_known_app(selected->type);
bool favorites = archive_get_tab(browser) == ArchiveTabFavorites;
bool consumed = false;

Expand All @@ -108,18 +106,19 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
consumed = true;
break;
case ArchiveBrowserEventFileMenuRun:
if(known_app) {
if(archive_is_known_app(selected->type)) {
archive_run_in_app(browser, selected);
archive_show_file_menu(browser, false);
}
consumed = true;
break;
case ArchiveBrowserEventFileMenuPin:
case ArchiveBrowserEventFileMenuPin: {
const char* name = archive_get_name(browser);
if(favorites) {
archive_favorites_delete(name);
archive_file_array_rm_selected(browser);
archive_show_file_menu(browser, false);
} else if(known_app) {
} else if(archive_is_known_app(selected->type)) {
if(archive_is_favorite("%s", name)) {
archive_favorites_delete("%s", name);
} else {
Expand All @@ -128,12 +127,12 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
archive_show_file_menu(browser, false);
}
consumed = true;
break;
} break;

case ArchiveBrowserEventFileMenuRename:
if(favorites) {
browser->callback(ArchiveBrowserEventEnterFavMove, browser->context);
} else if((known_app) && (selected->is_app == false)) {
} else if((archive_is_known_app(selected->type)) && (selected->is_app == false)) {
archive_show_file_menu(browser, false);
scene_manager_set_scene_state(
archive->scene_manager, ArchiveAppSceneBrowser, SCENE_STATE_NEED_REFRESH);
Expand Down

0 comments on commit 4460010

Please sign in to comment.