Handle exceptions at game list update

Should fix #4056
This commit is contained in:
Nekotekina 2018-01-16 17:57:29 +03:00
parent e2439e962c
commit 17ce5d9117
1 changed files with 11 additions and 5 deletions

View File

@ -424,7 +424,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
} }
// std::set is used to remove duplicates from the list // std::set is used to remove duplicates from the list
for (const auto& dir : std::set<std::string>(std::make_move_iterator(path_list.begin()), std::make_move_iterator(path_list.end()))) for (const auto& dir : std::set<std::string>(std::make_move_iterator(path_list.begin()), std::make_move_iterator(path_list.end()))) { try
{ {
const std::string sfb = dir + "/PS3_DISC.SFB"; const std::string sfb = dir + "/PS3_DISC.SFB";
const std::string sfo = dir + (fs::is_file(sfb) ? "/PS3_GAME/PARAM.SFO" : "/PARAM.SFO"); const std::string sfo = dir + (fs::is_file(sfb) ? "/PS3_GAME/PARAM.SFO" : "/PARAM.SFO");
@ -435,7 +435,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
continue; continue;
} }
const auto& psf = psf::load_object(sfo_file); const auto psf = psf::load_object(sfo_file);
GameInfo game; GameInfo game;
game.path = dir; game.path = dir;
@ -493,6 +493,12 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
m_game_data.push_back({ game, m_game_compat->GetCompatibility(game.serial), img, pxmap, true, bootable, hasCustomConfig }); m_game_data.push_back({ game, m_game_compat->GetCompatibility(game.serial), img, pxmap, true, bootable, hasCustomConfig });
} }
catch (const std::exception& e)
{
LOG_FATAL(GENERAL, "Failed to update game list at %s\n%s thrown: %s", dir, typeid(e).name(), e.what());
continue;
// Blame MSVC for double }}
}}
auto op = [](const GUI_GameInfo& game1, const GUI_GameInfo& game2) auto op = [](const GUI_GameInfo& game1, const GUI_GameInfo& game2)
{ {