Another try at avoiding a rare crash when editing custom collections.

This commit is contained in:
Leon Styhre 2023-03-05 13:20:27 +01:00
parent 96a5f1f056
commit 28ff747514

View file

@ -1213,8 +1213,9 @@ void ViewController::reloadGamelistView(GamelistView* view, bool reloadTheme)
system->getIndex()->setKidModeFilters(); system->getIndex()->setKidModeFilters();
std::shared_ptr<GamelistView> newView {getGamelistView(system)}; std::shared_ptr<GamelistView> newView {getGamelistView(system)};
// To counter having come from a placeholder. // Make sure we don't attempt to set the cursor to a nonexistent entry.
if (!cursor->isPlaceHolder() && cursor->getParent() != nullptr) auto children = system->getRootFolder()->getChildrenRecursive();
if (std::find(children.cbegin(), children.cend(), cursor) != children.cend())
newView->setCursor(cursor); newView->setCursor(cursor);
if (isCurrent) if (isCurrent)