1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 19:43:06 +01:00

Add extra NULL checks

This commit is contained in:
Michael Steenbeek
2017-11-13 19:28:37 +01:00
parent 2ebac91a2e
commit a663ab6cd2
2 changed files with 4 additions and 6 deletions

View File

@@ -46,11 +46,10 @@ void BannerObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
// Add banners to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab.
// Since this is already done the other way round for original items, avoid adding those to prevent duplicates.
const std::string identifier = GetIdentifier();
uint8 source = object_entry_get_source_game(object_list_find_by_name(identifier.c_str()));
const rct_object_entry * objectEntry = object_list_find_by_name(identifier.c_str());
static const rct_object_entry * scgPathX = object_list_find_by_name("SCGPATHX");
if (scgPathX != nullptr && source != OBJECT_SOURCE_RCT2)
if (objectEntry != nullptr && scgPathX != nullptr && object_entry_get_source_game(objectEntry) != OBJECT_SOURCE_RCT2)
{
SetPrimarySceneryGroup((rct_object_entry *)scgPathX);
}

View File

@@ -47,11 +47,10 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext * context, IStream * stre
// Add path bits to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab.
// Since this is already done the other way round for original items, avoid adding those to prevent duplicates.
const std::string identifier = GetIdentifier();
uint8 source = object_entry_get_source_game(object_list_find_by_name(identifier.c_str()));
const rct_object_entry * objectEntry = object_list_find_by_name(identifier.c_str());
static const rct_object_entry * scgPathX = object_list_find_by_name("SCGPATHX");
if (scgPathX != nullptr && source != OBJECT_SOURCE_RCT2)
if (objectEntry != nullptr && scgPathX != nullptr && object_entry_get_source_game(objectEntry) != OBJECT_SOURCE_RCT2)
{
SetPrimarySceneryGroup((rct_object_entry *)scgPathX);
}