Achievements: Fix crash starting with no game

This commit is contained in:
Stenzek 2025-04-10 02:29:45 +10:00
parent 15a81e5543
commit 21560537c2
No known key found for this signature in database

View File

@ -1207,7 +1207,7 @@ void Achievements::GameChanged(CDImage* image)
bool Achievements::IdentifyGame(CDImage* image) bool Achievements::IdentifyGame(CDImage* image)
{ {
if (s_state.game_path == image->GetPath()) if (s_state.game_path == (image ? std::string_view(image->GetPath()) : std::string_view()))
{ {
WARNING_LOG("Game path is unchanged."); WARNING_LOG("Game path is unchanged.");
return false; return false;
@ -1238,7 +1238,6 @@ bool Achievements::IdentifyGame(CDImage* image)
{ {
// only the path has changed - different format/save state/etc. // only the path has changed - different format/save state/etc.
INFO_LOG("Detected path change to '{}'", s_state.game_path); INFO_LOG("Detected path change to '{}'", s_state.game_path);
s_state.game_path = image->GetPath();
return false; return false;
} }