From 9a6d28f4ac655c71787f9b0b0f060f9b26671517 Mon Sep 17 00:00:00 2001 From: pawnishoovy <54544349+pawnishoovy@users.noreply.github.com> Date: Thu, 19 Dec 2024 20:53:32 +0200 Subject: [PATCH 1/2] null NextSongSection properly --- Source/Managers/MusicMan.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Managers/MusicMan.cpp b/Source/Managers/MusicMan.cpp index ff651df695..2c0cc57b02 100644 --- a/Source/Managers/MusicMan.cpp +++ b/Source/Managers/MusicMan.cpp @@ -100,6 +100,7 @@ void MusicMan::ResetMusicState() { bool MusicMan::PlayDynamicSong(const std::string& songName, const std::string& songSectionType, bool playImmediately, bool playTransition, bool smoothFade) { if (const DynamicSong* dynamicSongToPlay = dynamic_cast(g_PresetMan.GetEntityPreset("DynamicSong", songName))) { + m_NextSongSection = nullptr; m_CurrentSong = std::unique_ptr(dynamic_cast(dynamicSongToPlay->Clone())); SetNextSongSectionType(songSectionType); SelectNextSongSection(); From b0c5876ab0b84f8f6295ad7b8e7ea32e428edc9b Mon Sep 17 00:00:00 2001 From: pawnishoovy <54544349+pawnishoovy@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:02:15 +0200 Subject: [PATCH 2/2] also move assert up just in case --- Source/Entities/DynamicSong.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Entities/DynamicSong.cpp b/Source/Entities/DynamicSong.cpp index 6ddca35d84..bfcc52e339 100644 --- a/Source/Entities/DynamicSong.cpp +++ b/Source/Entities/DynamicSong.cpp @@ -166,6 +166,8 @@ SoundContainer& DynamicSongSection::SelectTransitionSoundContainer() { } SoundContainer& DynamicSongSection::SelectSoundContainer() { + RTEAssert(!m_SoundContainers.empty(), "Tried to get a SoundContainer from a DynamicSongSection with none to choose from!"); + // Shuffle between our options if we have multiple if (m_SoundContainers.size() != 1) { if (m_ShuffleUnplayedIndices.empty()) { @@ -198,8 +200,7 @@ SoundContainer& DynamicSongSection::SelectSoundContainer() { } } } - - RTEAssert(!m_SoundContainers.empty(), "Tried to get a SoundContainer from a DynamicSongSection with none to choose from!"); + return m_SoundContainers[0]; }