Skip to content

Commit

Permalink
Fix OpenRCT2#9324: crash trying to remove invalid footpath scenery.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed May 29, 2019
1 parent 4d7c78f commit bc90198
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/openrct2/actions/FootpathSceneryRemoveAction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ DEFINE_GAME_ACTION(FootpathSceneryRemoveAction, GAME_COMMAND_REMOVE_FOOTPATH_SCE
}

auto tileElement = map_get_footpath_element(_loc.x / 32, _loc.y / 32, _loc.z / 8);
auto pathElement = tileElement->AsPath();
if (tileElement == nullptr)
{
log_error("Could not find path element.");
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
}

auto pathElement = tileElement->AsPath();
if (pathElement == nullptr)
{
log_error("Could not find path element.");
log_warning("Could not find path element.");
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
}

Expand Down

0 comments on commit bc90198

Please sign in to comment.