diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 5a542c494b..f3f24b16ad 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -19,6 +19,7 @@ - Fix: [#22072] Objective date string and staff tenure date string cannot be reused on agglutinative languages. - Fix: [#22133] Ride time is incorrect for extremely slow speeds. - Fix: [#22231] Invalid object version can cause a crash. +- Fix: [#22479] Crash when a ride has no valid music object. - Fix: [#22562] Bottom row of pixels is not always drawn by the OpenGL renderer when zoomed in. - Fix: [#22653] Missing water tiles in RCT1 and RCT2 scenarios. - Fix: [#22654] Misplaced scenario elements in RCT1 and RCT2 scenarios. diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index f042db69e1..7a9fd0cbf1 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -5288,7 +5288,7 @@ namespace OpenRCT2::Ui::Windows // Do we have a preview image to draw? auto musicObj = ride->GetMusicObject(); - bool hasPreview = musicObj->HasPreview(); + bool hasPreview = musicObj != nullptr && musicObj->HasPreview(); if (!hasPreview) return; @@ -5321,6 +5321,9 @@ namespace OpenRCT2::Ui::Windows GfxClear(dpi, paletteIndex); auto* musicObj = ride->GetMusicObject(); + if (musicObj == nullptr) + return; + auto y = 0; for (size_t i = 0; i < musicObj->GetTrackCount(); i++)