1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Fix #14871: Crash in TrackPlaceAction::Execute (#14934)

This commit is contained in:
Michael Steenbeek
2021-06-21 21:27:14 +02:00
committed by GitHub
parent 005e6826b4
commit 8aeb763402
2 changed files with 6 additions and 1 deletions

View File

@@ -28,6 +28,7 @@
- Fix: [#14710] Ride/Track Design preview does not show if it costs more money than available.
- Fix: [#14774] Incorrect import of scenery research caused all scenery to be unlocked.
- Fix: [#14806] Incorrect function call in WallPlaceAction plugin code.
- Fix: [#14871] Crash when trying to place track when there are no free tile elements.
- Improved: [#14511] “Unlock operating limits” cheat now also unlocks all music.
- Improved: [#14712, #14716]: Improve startup times.

View File

@@ -547,7 +547,11 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const
}
auto* trackElement = TileElementInsert<TrackElement>(mapLoc, quarterTile.GetBaseQuarterOccupied());
Guard::Assert(trackElement != nullptr);
if (trackElement == nullptr)
{
log_warning("Cannot create track element for ride = %d", static_cast<int32_t>(_rideIndex));
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::NoFreeElements);
}
trackElement->SetClearanceZ(clearanceZ);
trackElement->SetDirection(_origin.direction);