diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp b/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp index eca9dd6190..61f365c85b 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp @@ -214,7 +214,15 @@ public: void unregisterHandlerForFrame (IPlugFrame* plugFrame) { if (auto* runLoop = getRunLoopFromFrame (plugFrame)) - refreshAttachedEventLoop ([this, runLoop] { hostRunLoops.erase (runLoop); }); + { + refreshAttachedEventLoop ([this, runLoop] + { + const auto it = hostRunLoops.find (runLoop); + + if (it != hostRunLoops.end()) + hostRunLoops.erase (it); + }); + } } /* Asserts if it can be established that the calling thread is different from the host's message