Fixed a crash caused by attempting to read data from a deleted object.

This commit is contained in:
Leon Styhre 2022-08-21 22:56:20 +02:00
parent 037cc34a57
commit ebb099de5a
2 changed files with 3 additions and 2 deletions

View file

@ -447,8 +447,7 @@ bool GamelistBase::input(InputConfig* config, Input input)
setCursor(getFirstEntry());
view->setCursor(view->getFirstEntry());
}
else if (selectLastEntry && mPrimary->size() > 0) {
setCursor(getLastEntry());
else if (selectLastEntry && view->getPrimary()->size() > 0) {
view->setCursor(view->getLastEntry());
}
// Display the indication icons which show what games are part of the

View file

@ -65,6 +65,8 @@ public:
protected:
GamelistBase(FileData* root);
PrimaryComponent<FileData*>* getPrimary() { return mPrimary; }
// Called when a FileData* is added, has its metadata changed, or is removed.
virtual void onFileChanged(FileData* file, bool reloadGamelist) = 0;