From ebb099de5a4ee6f832f1bc88ec854ffe3c1334f7 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 21 Aug 2022 22:56:20 +0200 Subject: [PATCH] Fixed a crash caused by attempting to read data from a deleted object. --- es-app/src/views/GamelistBase.cpp | 3 +-- es-app/src/views/GamelistBase.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/es-app/src/views/GamelistBase.cpp b/es-app/src/views/GamelistBase.cpp index dfe0310a1..12a1ed831 100644 --- a/es-app/src/views/GamelistBase.cpp +++ b/es-app/src/views/GamelistBase.cpp @@ -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 diff --git a/es-app/src/views/GamelistBase.h b/es-app/src/views/GamelistBase.h index 939be1861..5b285b049 100644 --- a/es-app/src/views/GamelistBase.h +++ b/es-app/src/views/GamelistBase.h @@ -65,6 +65,8 @@ public: protected: GamelistBase(FileData* root); + PrimaryComponent* getPrimary() { return mPrimary; } + // Called when a FileData* is added, has its metadata changed, or is removed. virtual void onFileChanged(FileData* file, bool reloadGamelist) = 0;