summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;