summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2012-02-04 22:14:21 +0000
committermichi_cc <michi_cc@openttd.org>2012-02-04 22:14:21 +0000
commitbd3c50791024b313208a4e163b7632554d8b5e9c (patch)
tree3b8a824506b25a867b2a0fc9275f4b70d5ea84c8
parentdd5d24c35a8806cdb9937cdb9e45a2ed2d093811 (diff)
downloadopenttd-bd3c50791024b313208a4e163b7632554d8b5e9c.tar.xz
(svn r23896) -Fix (r23884): Don't free unallocated memory.
-rw-r--r--src/spritecache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 83c6a15ae..75e402bed 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -885,7 +885,7 @@ void GfxClearSpriteCache()
/* Clear sprite ptr for all cached items */
for (uint i = 0; i != _spritecache_items; i++) {
SpriteCache *sc = GetSpriteCache(i);
- if (sc->type != ST_RECOLOUR) DeleteEntryFromSpriteCache(i);
+ if (sc->type != ST_RECOLOUR && sc->ptr != NULL) DeleteEntryFromSpriteCache(i);
}
}