Skip to content

Commit

Permalink
Fix OpenRCT2#10087: crash loading a save with corrupt peeps
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed Oct 20, 2019
1 parent 86474df commit dbbbf22
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/openrct2/Game.cpp
Expand Up @@ -603,11 +603,18 @@ void game_fix_save_vars()
{
continue;
}
Ride* ride = get_ride(rideIdx);
if (ride == nullptr)
{
log_warning("Couldn't find ride, removing peep %u", spriteIndex);
peepsToRemove.push_back(peep);
continue;
}
set_format_arg(0, uint32_t, peep->id);
auto curName = peep->GetName();
log_warning(
"Peep %u (%s) has invalid ride station = %u for ride %u.", spriteIndex, curName.c_str(), srcStation, rideIdx);
int8_t station = ride_get_first_valid_station_exit(get_ride(rideIdx));
int8_t station = ride_get_first_valid_station_exit(ride);
if (station == -1)
{
log_warning("Couldn't find station, removing peep %u", spriteIndex);
Expand Down

0 comments on commit dbbbf22

Please sign in to comment.