summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-29 00:29:28 +0000
committerrubidium <rubidium@openttd.org>2008-01-29 00:29:28 +0000
commitc9a9103566e7be441d79255fedf9752a53ab5ee9 (patch)
tree36481130a8ab6c19479309997e82f64e5631a163 /src
parent3b2145aafe29d6abd8aeef3dccdb5cf587f111d2 (diff)
downloadopenttd-c9a9103566e7be441d79255fedf9752a53ab5ee9.tar.xz
(svn r12005) -Fix [FS#1717]: possible reading from an invalid pointer. Patch by PhilSophus.
Diffstat (limited to 'src')
-rw-r--r--src/spritecache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 1ea6816a7..2533a6b11 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -262,8 +262,8 @@ bool LoadNextSprite(int load_index, byte file_slot, uint file_sprite_id)
void DupSprite(SpriteID old_spr, SpriteID new_spr)
{
+ SpriteCache *scnew = AllocateSpriteCache(new_spr); // may reallocate: so put it first
SpriteCache *scold = GetSpriteCache(old_spr);
- SpriteCache *scnew = AllocateSpriteCache(new_spr);
scnew->file_slot = scold->file_slot;
scnew->file_pos = scold->file_pos;