From c04d635ddb35db736864273df655803a202ac80b Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 8 Nov 2013 22:28:57 +0000 Subject: (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 --- src/newgrf_storage.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/newgrf_storage.h') 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(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; } }; -- cgit v1.2.3-54-g00ecf