mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 03:55:40 +00:00
Fixed a few crashes related to GameSelectorComponent.
This commit is contained in:
parent
57a594225a
commit
eb3729a5fb
|
@ -1096,7 +1096,7 @@ SystemData* SystemData::getRandomSystem(const SystemData* currentSystem)
|
|||
return randomSystem;
|
||||
}
|
||||
|
||||
FileData* SystemData::getRandomGame(const FileData* currentGame)
|
||||
FileData* SystemData::getRandomGame(const FileData* currentGame, bool gameSelectorMode)
|
||||
{
|
||||
std::vector<FileData*> gameList;
|
||||
bool onlyFolders = false;
|
||||
|
@ -1109,12 +1109,17 @@ FileData* SystemData::getRandomGame(const FileData* currentGame)
|
|||
gameList = mRootFolder->getParent()->getChildrenListToDisplay();
|
||||
}
|
||||
else {
|
||||
gameList = ViewController::getInstance()
|
||||
->getGamelistView(mRootFolder->getSystem())
|
||||
.get()
|
||||
->getCursor()
|
||||
->getParent()
|
||||
->getChildrenListToDisplay();
|
||||
if (gameSelectorMode) {
|
||||
gameList = mRootFolder->getFilesRecursive(GAME, false, false);
|
||||
}
|
||||
else {
|
||||
gameList = ViewController::getInstance()
|
||||
->getGamelistView(mRootFolder->getSystem())
|
||||
.get()
|
||||
->getCursor()
|
||||
->getParent()
|
||||
->getChildrenListToDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
if (gameList.size() > 0 && gameList.front()->getParent()->getOnlyFoldersFlag())
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
SystemData* getNext() const;
|
||||
SystemData* getPrev() const;
|
||||
static SystemData* getRandomSystem(const SystemData* currentSystem);
|
||||
FileData* getRandomGame(const FileData* currentGame = nullptr);
|
||||
FileData* getRandomGame(const FileData* currentGame = nullptr, bool gameSelectorMode = false);
|
||||
FileData* getPlaceholder() { return mPlaceholder; }
|
||||
|
||||
void sortSystem(bool reloadGamelist = true, bool jumpToFirstRow = false);
|
||||
|
|
|
@ -34,7 +34,9 @@ public:
|
|||
|
||||
if (mGameSelection == GameSelection::RANDOM) {
|
||||
for (int i = 0; i < mGameCount; ++i) {
|
||||
FileData* randomGame {mSystem->getRandomGame()};
|
||||
if (mSystem->getRootFolder()->getGameCount().first == 0)
|
||||
break;
|
||||
FileData* randomGame {mSystem->getRandomGame(nullptr, true)};
|
||||
if (randomGame != nullptr)
|
||||
mGames.emplace_back(randomGame);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue