CommonHostInterface: Fix crash booting exe/psf from file

This commit is contained in:
Connor McLaughlin 2021-05-01 02:58:43 +10:00
parent f8bbade9bf
commit e8fece60cf
1 changed files with 7 additions and 4 deletions

View File

@ -2904,8 +2904,10 @@ void CommonHostInterface::GetGameInfo(const char* path, CDImage* image, std::str
{ {
*code = list_entry->code; *code = list_entry->code;
*title = list_entry->title; *title = list_entry->title;
return;
} }
else
if (image)
{ {
GameDatabase database; GameDatabase database;
GameDatabaseEntry database_entry; GameDatabaseEntry database_entry;
@ -2913,14 +2915,15 @@ void CommonHostInterface::GetGameInfo(const char* path, CDImage* image, std::str
{ {
*code = std::move(database_entry.serial); *code = std::move(database_entry.serial);
*title = std::move(database_entry.title); *title = std::move(database_entry.title);
return;
} }
else else
{ {
*title = FileSystem::GetFileTitleFromPath(std::string(path)); *code = System::GetGameCodeForImage(image, true);
if (image)
*code = System::GetGameCodeForImage(image, true);
} }
} }
*title = FileSystem::GetFileTitleFromPath(path);
} }
bool CommonHostInterface::SaveResumeSaveState() bool CommonHostInterface::SaveResumeSaveState()