Fix #12535, #12536: RCT1 import can crash when too many misc entities (#12580)

Eventually this can be fixed properly in the new save format
This commit is contained in:
Duncan 2020-08-04 00:07:13 +01:00 committed by GitHub
parent 4fcdcc3729
commit 87953ace9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -1659,6 +1659,11 @@ private:
{
rct1_unk_sprite* src = &sprite.unknown;
SpriteGeneric* dst = reinterpret_cast<SpriteGeneric*>(create_sprite(SPRITE_IDENTIFIER_MISC));
if (dst == nullptr)
{
log_warning("SV4 has too many misc entities. No more misc entities will be imported!");
break;
}
dst->sprite_identifier = src->sprite_identifier;
dst->type = src->type;
dst->flags = src->flags;