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

This commit is contained in:
Michael Steenbeek authored and GitHub committed 2021-06-21 16:27:14 -03:00
1 parent 005e6826b4
commit 8aeb763402
2 files changed
+6 -1

No files matched your search

+1
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.
+5 -1
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);