summaryrefslogtreecommitdiff
path: root/src/newgrf_storage.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-11-08 22:28:57 +0000
committerrubidium <rubidium@openttd.org>2013-11-08 22:28:57 +0000
commitc04d635ddb35db736864273df655803a202ac80b (patch)
treef80b8e1804cb030fc9488ca5e944132be58880fe /src/newgrf_storage.h
parent169bf3a403883471cd74f52b416085af96fc5097 (diff)
downloadopenttd-c04d635ddb35db736864273df655803a202ac80b.tar.xz
(svn r25956) -Fix [FS#5772]: temporary persistent storage modifications, e.g. command tests or those from GUI, were not properly reset, creating the possibility of desyncs
Diffstat (limited to 'src/newgrf_storage.h')
-rw-r--r--src/newgrf_storage.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h
index f5044b05d..528d4ff3c 100644
--- a/src/newgrf_storage.h
+++ b/src/newgrf_storage.h
@@ -84,7 +84,7 @@ struct PersistentStorageArray : BaseStorageArray {
if (this->storage[pos] == value) return;
/* We do not have made a backup; lets do so */
- if (this->prev_storage != NULL) {
+ if (this->prev_storage == NULL) {
this->prev_storage = MallocT<TYPE>(SIZE);
memcpy(this->prev_storage, this->storage, sizeof(this->storage));
@@ -121,6 +121,7 @@ struct PersistentStorageArray : BaseStorageArray {
memcpy(this->storage, this->prev_storage, sizeof(this->storage));
}
free(this->prev_storage);
+ this->prev_storage = NULL;
}
};