Guard against NULL ObjectRepositoryItem, fixes #5614

This commit is contained in:
Gymnasiast 2017-06-24 17:44:30 +02:00
parent 21e65934d6
commit c9b5ec4172
1 changed files with 6 additions and 4 deletions

View File

@ -119,7 +119,7 @@ public:
{
const ObjectRepositoryItem * ori = repo->FindObject(item.ObjectEntry.c_str());
if (gConfigInterface.select_by_track_type || !(ori->RideFlags & ORI_RIDE_FLAG_SEPARATE))
if (gConfigInterface.select_by_track_type || ori == nullptr || !(ori->RideFlags & ORI_RIDE_FLAG_SEPARATE))
entryIsNotSeparate = true;
}
@ -144,7 +144,8 @@ public:
}
const ObjectRepositoryItem * ori = repo->FindObject(item.ObjectEntry.c_str());
ride_group * itemRideGroup = ride_group_find(rideType, ori->RideGroupIndex);
uint8 rideGroupIndex = (ori != nullptr) ? ori->RideGroupIndex : 0;
ride_group * itemRideGroup = ride_group_find(rideType, rideGroupIndex);
if (itemRideGroup != NULL && ride_groups_are_equal(itemRideGroup, rideGroup))
{
@ -179,7 +180,7 @@ public:
{
const ObjectRepositoryItem * ori = repo->FindObject(item.ObjectEntry.c_str());
if (gConfigInterface.select_by_track_type || !(ori->RideFlags & ORI_RIDE_FLAG_SEPARATE))
if (gConfigInterface.select_by_track_type || ori == nullptr || !(ori->RideFlags & ORI_RIDE_FLAG_SEPARATE))
entryIsNotSeparate = true;
}
@ -209,7 +210,8 @@ public:
}
const ObjectRepositoryItem * ori = repo->FindObject(item.ObjectEntry.c_str());
ride_group * itemRideGroup = ride_group_find(rideType, ori->RideGroupIndex);
uint8 rideGroupIndex = (ori != nullptr) ? ori->RideGroupIndex : 0;
ride_group * itemRideGroup = ride_group_find(rideType, rideGroupIndex);
if (itemRideGroup != NULL && ride_groups_are_equal(itemRideGroup, rideGroup))
{