From b98f2cfc4fbc240de599e92d57c384ee45e84d85 Mon Sep 17 00:00:00 2001 From: maxwell hayes Date: Tue, 11 Oct 2022 14:52:38 -0400 Subject: [PATCH] Clamping submix effect chain entry index in Audio Mixer Blueprint Library #jria UE-165936, UE-165938 #rb ryan.mangin, phil.popp #preflight 633f3026607039cbc11855b5 [CL 22462682 by maxwell hayes in ue5-main branch] --- .../AudioMixer/Private/AudioMixerBlueprintLibrary.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Engine/Source/Runtime/AudioMixer/Private/AudioMixerBlueprintLibrary.cpp b/Engine/Source/Runtime/AudioMixer/Private/AudioMixerBlueprintLibrary.cpp index 494a09a28518..2b2dfe7c7c64 100644 --- a/Engine/Source/Runtime/AudioMixer/Private/AudioMixerBlueprintLibrary.cpp +++ b/Engine/Source/Runtime/AudioMixer/Private/AudioMixerBlueprintLibrary.cpp @@ -536,12 +536,11 @@ void UAudioMixerBlueprintLibrary::RemoveSourceEffectFromPresetChain(const UObjec Chain = PresetChain->Chain; } - if (EntryIndex < Chain.Num()) + if (EntryIndex >= 0 && EntryIndex < Chain.Num()) { Chain.RemoveAt(EntryIndex); + MixerDevice->UpdateSourceEffectChain(PresetChainId, Chain, PresetChain->bPlayEffectChainTails); } - - MixerDevice->UpdateSourceEffectChain(PresetChainId, Chain, PresetChain->bPlayEffectChainTails); } } @@ -565,12 +564,11 @@ void UAudioMixerBlueprintLibrary::SetBypassSourceEffectChainEntry(const UObject* Chain = PresetChain->Chain; } - if (EntryIndex < Chain.Num()) + if (EntryIndex >= 0 && EntryIndex < Chain.Num()) { Chain[EntryIndex].bBypass = bBypassed; + MixerDevice->UpdateSourceEffectChain(PresetChainId, Chain, PresetChain->bPlayEffectChainTails); } - - MixerDevice->UpdateSourceEffectChain(PresetChainId, Chain, PresetChain->bPlayEffectChainTails); } }