1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Fix crash when ducks try to navigate out of bounds

This commit is contained in:
Matt
2019-10-15 17:32:44 +02:00
parent 01ea0ae366
commit ac30e35dfa

View File

@@ -124,7 +124,7 @@ void rct_duck::UpdateFlyToWater()
int32_t manhattanDistanceN = abs(target_x - newX) + abs(target_y - newY);
auto surfaceElement = map_get_surface_element_at({ target_x, target_y });
int32_t waterHeight = surfaceElement->GetWaterHeight();
int32_t waterHeight = surfaceElement != nullptr ? surfaceElement->GetWaterHeight() : 0;
if (waterHeight == 0)
{
state = DUCK_STATE::FLY_AWAY;