mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
VST3 Client: Add null checks, in case Edit Controller is used before being connected
This commit is contained in:
parent
76215d2dd0
commit
e42ab22a78
1 changed files with 14 additions and 6 deletions
|
|
@ -1140,6 +1140,12 @@ public:
|
|||
Vst::ParamID oldParamID,
|
||||
Vst::ParamID& newParamID) override
|
||||
{
|
||||
if (audioProcessor == nullptr)
|
||||
{
|
||||
jassertfalse;
|
||||
return kResultFalse;
|
||||
}
|
||||
|
||||
const auto parameterMap = audioProcessor->getParameterMap (toVST3InterfaceId (pluginToReplaceUID));
|
||||
const auto iter = parameterMap.find (oldParamID);
|
||||
|
||||
|
|
@ -1215,24 +1221,26 @@ public:
|
|||
// As an IEditController member, the host should only call this from the message thread.
|
||||
assertHostMessageThread();
|
||||
|
||||
if (auto* pluginInstance = getPluginInstance())
|
||||
if (audioProcessor != nullptr)
|
||||
{
|
||||
auto* pluginInstance = getPluginInstance();
|
||||
|
||||
for (auto vstParamId : audioProcessor->getParamIDs())
|
||||
{
|
||||
auto paramValue = [&]
|
||||
auto paramValue = std::invoke ([&]
|
||||
{
|
||||
if (vstParamId == audioProcessor->getProgramParamID())
|
||||
if (vstParamId == audioProcessor->getProgramParamID() && pluginInstance != nullptr)
|
||||
return EditController::plainParamToNormalized (audioProcessor->getProgramParamID(),
|
||||
pluginInstance->getCurrentProgram());
|
||||
|
||||
return (double) audioProcessor->getParamForVSTParamID (vstParamId)->getValue();
|
||||
}();
|
||||
});
|
||||
|
||||
setParamNormalized (vstParamId, paramValue);
|
||||
}
|
||||
}
|
||||
|
||||
audioProcessor->updateParameterMapping();
|
||||
audioProcessor->updateParameterMapping();
|
||||
}
|
||||
|
||||
if (auto* handler = getComponentHandler())
|
||||
handler->restartComponent (Vst::kParamValuesChanged | Vst::kParamIDMappingChanged);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue