From 87953ace9b492b3558fb676d2dfaab3aecff1455 Mon Sep 17 00:00:00 2001 From: Duncan Date: Tue, 4 Aug 2020 00:07:13 +0100 Subject: [PATCH] Fix #12535, #12536: RCT1 import can crash when too many misc entities (#12580) Eventually this can be fixed properly in the new save format --- src/openrct2/rct1/S4Importer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index c3765ad6b7..bd84d97fdd 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1659,6 +1659,11 @@ private: { rct1_unk_sprite* src = &sprite.unknown; SpriteGeneric* dst = reinterpret_cast(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;