aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/savegame.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 498158ed17..bf251eafcb 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -587,9 +587,13 @@ static void sync_SystemString(Common::Serializer &s, SystemString &obj) {
tmp = obj._value;
s.syncString(tmp);
if (s.isLoading()) {
- //free(*str);
- obj._value = (char *)calloc(obj._maxSize, sizeof(char));
- strncpy(obj._value, tmp.c_str(), obj._maxSize);
+ if (!obj._maxSize) {
+ obj._value = NULL;
+ } else {
+ //free(*str);
+ obj._value = (char *)calloc(obj._maxSize, sizeof(char));
+ strncpy(obj._value, tmp.c_str(), obj._maxSize);
+ }
}
}