summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-21 13:21:23 +0000
committerfrosch <frosch@openttd.org>2012-01-21 13:21:23 +0000
commit5fa15c563cde6bfdc97233f48817fcdd7c200b70 (patch)
tree3a68034abced86502601e7ab7c57e4029d15a522
parent9f162e7115031cb42f80db399d63774f479c4125 (diff)
downloadopenttd-5fa15c563cde6bfdc97233f48817fcdd7c200b70.tar.xz
(svn r23828) -Fix: Return early from SlString() for empty strings, before doing invalid things which surprisingly do not break everything.
-rw-r--r--src/saveload/saveload.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 74274c1f4..1eb6da59c 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1086,6 +1086,7 @@ static void SlString(void *ptr, size_t length, VarType conv)
free(*(char **)ptr);
if (len == 0) {
*(char **)ptr = NULL;
+ return;
} else {
*(char **)ptr = MallocT<char>(len + 1); // terminating '\0'
ptr = *(char **)ptr;