mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Fixed a potential crash when deleting the last custom collection.
This commit is contained in:
parent
04453c42ff
commit
05bcb9b011
|
@ -273,6 +273,10 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(Window* window, std::st
|
||||||
Settings::getInstance()->getString("CollectionSystemsCustom")) {
|
Settings::getInstance()->getString("CollectionSystemsCustom")) {
|
||||||
Settings::getInstance()->setString("CollectionSystemsCustom",
|
Settings::getInstance()->setString("CollectionSystemsCustom",
|
||||||
collectionsConfigEntry);
|
collectionsConfigEntry);
|
||||||
|
if (selectedCustomCollections.size() == 1 &&
|
||||||
|
Settings::getInstance()->getString("StartupSystem") ==
|
||||||
|
"collections")
|
||||||
|
Settings::getInstance()->setString("StartupSystem", "");
|
||||||
setNeedsSaving();
|
setNeedsSaving();
|
||||||
setNeedsGoToStart();
|
setNeedsGoToStart();
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,24 +99,28 @@ void GuiMenu::openUIOptions()
|
||||||
auto s = new GuiSettings(mWindow, "UI SETTINGS");
|
auto s = new GuiSettings(mWindow, "UI SETTINGS");
|
||||||
|
|
||||||
// Optionally start in selected system/gamelist.
|
// Optionally start in selected system/gamelist.
|
||||||
auto startup_system = std::make_shared<OptionListComponent<std::string>>(
|
auto startupSystem = std::make_shared<OptionListComponent<std::string>>(
|
||||||
mWindow, getHelpStyle(), "GAMELIST ON STARTUP", false);
|
mWindow, getHelpStyle(), "GAMELIST ON STARTUP", false);
|
||||||
startup_system->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
startupSystem->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
||||||
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
||||||
it != SystemData::sSystemVector.cend(); ++it) {
|
it != SystemData::sSystemVector.cend(); ++it) {
|
||||||
if ((*it)->getName() != "retropie") {
|
if ((*it)->getName() != "retropie") {
|
||||||
// If required, abbreviate the system name so it doesn't overlap the setting name.
|
// If required, abbreviate the system name so it doesn't overlap the setting name.
|
||||||
float maxNameLength = mSize.x * 0.48f;
|
float maxNameLength = mSize.x * 0.48f;
|
||||||
startup_system->add((*it)->getFullName(), (*it)->getName(),
|
startupSystem->add((*it)->getFullName(), (*it)->getName(),
|
||||||
Settings::getInstance()->getString("StartupSystem") ==
|
Settings::getInstance()->getString("StartupSystem") ==
|
||||||
(*it)->getName(),
|
(*it)->getName(),
|
||||||
maxNameLength);
|
maxNameLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->addWithLabel("GAMELIST ON STARTUP", startup_system);
|
// This can probably not happen but as an extra precaution select the "NONE" entry if no
|
||||||
s->addSaveFunc([startup_system, s] {
|
// entry is selected.
|
||||||
if (startup_system->getSelected() != Settings::getInstance()->getString("StartupSystem")) {
|
if (startupSystem->getSelectedObjects().size() == 0)
|
||||||
Settings::getInstance()->setString("StartupSystem", startup_system->getSelected());
|
startupSystem->selectEntry(0);
|
||||||
|
s->addWithLabel("GAMELIST ON STARTUP", startupSystem);
|
||||||
|
s->addSaveFunc([startupSystem, s] {
|
||||||
|
if (startupSystem->getSelected() != Settings::getInstance()->getString("StartupSystem")) {
|
||||||
|
Settings::getInstance()->setString("StartupSystem", startupSystem->getSelected());
|
||||||
s->setNeedsSaving();
|
s->setNeedsSaving();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue