aboutsummaryrefslogtreecommitdiff
path: root/engines/cine/saveload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cine/saveload.cpp')
-rw-r--r--engines/cine/saveload.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp
index be1e19b229..158d209289 100644
--- a/engines/cine/saveload.cpp
+++ b/engines/cine/saveload.cpp
@@ -468,9 +468,18 @@ bool CineEngine::loadSaveDirectory(void) {
return false;
}
+ // Initialize all savegames' descriptions to empty strings
+ // so that if the savegames' descriptions can only be partially read from file
+ // then the missing ones are correctly set to empty strings.
+ memset(currentSaveName, 0, sizeof(currentSaveName));
+
fHandle->read(currentSaveName, 10 * 20);
delete fHandle;
+ // Make sure all savegames' descriptions end with a trailing zero.
+ for (int i = 0; i < ARRAYSIZE(currentSaveName); i++)
+ currentSaveName[i][sizeof(CommandeType) - 1] = 0;
+
return true;
}