From 28ff74751472209f081305f9debed11ddcc1e08d Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 5 Mar 2023 13:20:27 +0100 Subject: [PATCH] Another try at avoiding a rare crash when editing custom collections. --- es-app/src/views/ViewController.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 85ae276cb..e349efaba 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -1213,8 +1213,9 @@ void ViewController::reloadGamelistView(GamelistView* view, bool reloadTheme) system->getIndex()->setKidModeFilters(); std::shared_ptr newView {getGamelistView(system)}; - // To counter having come from a placeholder. - if (!cursor->isPlaceHolder() && cursor->getParent() != nullptr) + // Make sure we don't attempt to set the cursor to a nonexistent entry. + auto children = system->getRootFolder()->getChildrenRecursive(); + if (std::find(children.cbegin(), children.cend(), cursor) != children.cend()) newView->setCursor(cursor); if (isCurrent)