Skip to content

Commit

Permalink
Fixed|Client|libcommon: Handling a corrupt save file without terminating
Browse files Browse the repository at this point in the history
The case of a save file with bad metadata should be gracefully
handled with normal error messages.

http://talk.dengine.net/discussion/2489/new-error-on-launch-app-init-failed-gameidentitykey-not-found
  • Loading branch information
skyjake committed Sep 18, 2017
1 parent 33c3431 commit e550527
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions doomsday/apps/client/src/ui/savelistdata.cpp
Expand Up @@ -75,10 +75,19 @@ DENG2_PIMPL(SaveListData)
{
foreach (File *file, SaveGames::get().saveIndex().files())
{
GameStateFolder &save = file->as<GameStateFolder>();
if (shouldAddFolder(save))
try
{
self().append(new SaveItem(save));
GameStateFolder &save = file->as<GameStateFolder>();
if (shouldAddFolder(save))
{
self().append(new SaveItem(save));
}
}
catch (Error const &er)
{
LOG_ERROR("Save file %s has corrupt metadata: %s")
<< file->description()
<< er.asText();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/plugins/common/src/game/saveslots.cpp
Expand Up @@ -67,7 +67,7 @@ DENG2_PIMPL_NOREF(SaveSlots::Slot)
{
status = Incompatible;
// Game identity key missmatch?
if (!session->metadata().gets("gameIdentityKey").compareWithoutCase(COMMON_GAMESESSION->gameId()))
if (!session->metadata().gets("gameIdentityKey", "").compareWithoutCase(COMMON_GAMESESSION->gameId()))
{
/// @todo Validate loaded add-ons and checksum the definition database.
status = Loadable; // It's good!
Expand Down

0 comments on commit e550527

Please sign in to comment.