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()->setString("CollectionSystemsCustom",
|
||||
collectionsConfigEntry);
|
||||
if (selectedCustomCollections.size() == 1 &&
|
||||
Settings::getInstance()->getString("StartupSystem") ==
|
||||
"collections")
|
||||
Settings::getInstance()->setString("StartupSystem", "");
|
||||
setNeedsSaving();
|
||||
setNeedsGoToStart();
|
||||
}
|
||||
|
|
|
@ -99,24 +99,28 @@ void GuiMenu::openUIOptions()
|
|||
auto s = new GuiSettings(mWindow, "UI SETTINGS");
|
||||
|
||||
// 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);
|
||||
startup_system->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
||||
startupSystem->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
||||
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
||||
it != SystemData::sSystemVector.cend(); ++it) {
|
||||
if ((*it)->getName() != "retropie") {
|
||||
// If required, abbreviate the system name so it doesn't overlap the setting name.
|
||||
float maxNameLength = mSize.x * 0.48f;
|
||||
startup_system->add((*it)->getFullName(), (*it)->getName(),
|
||||
startupSystem->add((*it)->getFullName(), (*it)->getName(),
|
||||
Settings::getInstance()->getString("StartupSystem") ==
|
||||
(*it)->getName(),
|
||||
maxNameLength);
|
||||
}
|
||||
}
|
||||
s->addWithLabel("GAMELIST ON STARTUP", startup_system);
|
||||
s->addSaveFunc([startup_system, s] {
|
||||
if (startup_system->getSelected() != Settings::getInstance()->getString("StartupSystem")) {
|
||||
Settings::getInstance()->setString("StartupSystem", startup_system->getSelected());
|
||||
// This can probably not happen but as an extra precaution select the "NONE" entry if no
|
||||
// entry is selected.
|
||||
if (startupSystem->getSelectedObjects().size() == 0)
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue