From 238246cebf72dabc8cd6742193e9a15ad2666acf Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Mon, 26 Jul 2021 07:36:02 -0500 Subject: [PATCH] Fixed crash when launching or changing addons order --- src/moon/mod-engine/audio/mod-audio.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/moon/mod-engine/audio/mod-audio.cpp b/src/moon/mod-engine/audio/mod-audio.cpp index afe83199..4e6375ed 100644 --- a/src/moon/mod-engine/audio/mod-audio.cpp +++ b/src/moon/mod-engine/audio/mod-audio.cpp @@ -5,6 +5,7 @@ #include "moon/mod-engine/engine.h" #include "moon/mod-engine/hooks/hook.h" #include "moon/mod-engine/interfaces/sound-entry.h" +#include "moon/mod-engine/interfaces/file-entry.h" extern "C" { #include "text/libs/io_utils.h" @@ -81,8 +82,11 @@ namespace MoonInternal { void buildAudioCache(vector order){ soundCache.clear(); - for(int i = 0; i < order.size(); i++) - soundCache.push_back(Moon::addons[order[i]]); + for(int i = 0; i < order.size(); i++){ + BitModule* addon = Moon::addons[order[i]]; + if(addon->sounds != nullptr) + soundCache.push_back(addon); + } Moon::setSoundEntry(soundCache[soundCache.size() - 1]->sounds); }