Skip to content

Commit

Permalink
Fix OpenRCT2#9322: Peep crashing the game trying to find a ride to lo…
Browse files Browse the repository at this point in the history
…ok at
  • Loading branch information
ZehMatt committed May 29, 2019
1 parent 4d7c78f commit 31b5450
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/openrct2/peep/Guest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6278,6 +6278,11 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, uint8_t* rideToV
surfaceElement = map_get_surface_element_at({ peep->next_x, peep->next_y });

tileElement = surfaceElement;
if (tileElement == nullptr)
{
return false;
}

do
{
// Ghosts are purely this-client-side and should not cause any interaction,
Expand Down Expand Up @@ -6312,6 +6317,11 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, uint8_t* rideToV
surfaceElement = map_get_surface_element_at({ x, y });

tileElement = surfaceElement;
if (tileElement == nullptr)
{
return false;
}

do
{
// Ghosts are purely this-client-side and should not cause any interaction,
Expand Down Expand Up @@ -6341,6 +6351,8 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, uint8_t* rideToV
tileElement = surfaceElement;
do
{
if (tileElement == nullptr)
break;
// Ghosts are purely this-client-side and should not cause any interaction,
// as that may lead to a desync.
if (network_get_mode() != NETWORK_MODE_NONE)
Expand Down Expand Up @@ -6385,6 +6397,8 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, uint8_t* rideToV
tileElement = surfaceElement;
do
{
if (tileElement == nullptr)
break;
// Ghosts are purely this-client-side and should not cause any interaction,
// as that may lead to a desync.
if (network_get_mode() != NETWORK_MODE_NONE)
Expand Down Expand Up @@ -6541,6 +6555,11 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, uint8_t* rideToV

// TODO: extract loop A
tileElement = surfaceElement;
if (tileElement == nullptr)
{
return false;
}

do
{
// Ghosts are purely this-client-side and should not cause any interaction,
Expand Down

0 comments on commit 31b5450

Please sign in to comment.