Fix crash when replacing recolour sprite with normal sprite

See: #712
This commit is contained in:
Jonathan G Rennison 2024-07-06 13:34:44 +01:00
parent 18ef0741e7
commit 61b39296e1

View File

@ -752,14 +752,13 @@ bool LoadNextSprite(int load_index, SpriteFile &file, uint file_sprite_id)
}
SpriteCache *sc = AllocateSpriteCache(load_index);
sc->Clear(); // Clear existing entry before changing type field
sc->file = &file;
sc->file_pos = file_pos;
sc->SetType(type);
if (data != nullptr) {
assert(data == _last_sprite_allocation.GetPtr());
sc->Assign(std::move(_last_sprite_allocation));
} else {
sc->Clear();
}
sc->id = file_sprite_id;
sc->count = count;