mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 22:25:38 +00:00
Fixed an issue where an invalid scraper entry in es_settings.xml could lead to a crash.
This commit is contained in:
parent
46228c6a9d
commit
af337124d6
|
@ -32,6 +32,11 @@ GuiScraperMenu::GuiScraperMenu(Window* window, std::string title)
|
||||||
// just in case the scraper from settings has vanished.
|
// just in case the scraper from settings has vanished.
|
||||||
for (auto it = scrapers.cbegin(); it != scrapers.cend(); it++)
|
for (auto it = scrapers.cbegin(); it != scrapers.cend(); it++)
|
||||||
mScraper->add(*it, *it, *it == Settings::getInstance()->getString("Scraper"));
|
mScraper->add(*it, *it, *it == Settings::getInstance()->getString("Scraper"));
|
||||||
|
// If there are no objects returned, then there must be a manually modified entry in the
|
||||||
|
// configuration file. Simply set the scraper to "screenscraper" in this case.
|
||||||
|
if (mScraper->getSelectedObjects().size() == 0)
|
||||||
|
mScraper->selectEntry(0);
|
||||||
|
|
||||||
mMenu.addWithLabel("SCRAPE FROM", mScraper);
|
mMenu.addWithLabel("SCRAPE FROM", mScraper);
|
||||||
|
|
||||||
// Search filters, getSearches() will generate a queue of games to scrape
|
// Search filters, getSearches() will generate a queue of games to scrape
|
||||||
|
|
|
@ -80,8 +80,15 @@ std::vector<std::string> getScraperList()
|
||||||
|
|
||||||
bool isValidConfiguredScraper()
|
bool isValidConfiguredScraper()
|
||||||
{
|
{
|
||||||
const std::string& name = Settings::getInstance()->getString("Scraper");
|
std::string scraper = Settings::getInstance()->getString("Scraper");
|
||||||
return scraper_request_funcs.find(name) != scraper_request_funcs.end();
|
// Handle a potentially invalid entry in the configuration file.
|
||||||
|
if (scraper != "screenscraper" && scraper != "thegamesdb") {
|
||||||
|
scraper = "screenscraper";
|
||||||
|
Settings::getInstance()->setString("Scraper", scraper);
|
||||||
|
Settings::getInstance()->saveFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
return scraper_request_funcs.find(scraper) != scraper_request_funcs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScraperSearchHandle::update()
|
void ScraperSearchHandle::update()
|
||||||
|
|
Loading…
Reference in a new issue