Juce 6. JUCE Assertion failure in juce_AudioProcessorValueTreeState.cpp:495

After update to Juce 6 I received the error in

template <typename Attachment, typename Control>
std::unique_ptr<Attachment> makeAttachment (const AudioProcessorValueTreeState& stateToUse,
                                            const String& parameterID,
                                            Control& control)
    if (auto* parameter = stateToUse.getParameter (parameterID))
        return std::make_unique<Attachment> (*parameter, control, stateToUse.undoManager);

return nullptr;}

It calls after
buttonsBlock.forwardButtonAttachment.reset ( new ButtonAttachment (valueTreeState, buttonsBlock.forwardButton.getName(), buttonsBlock.forwardButton));

How can I fix it? What is the problem?

Thank you

It’s likely that the plugin is trying to create an attachment for a parameter ID which hasn’t been added to the APVTS. I’d suggest checking the value of parameterID when this assertion is hit, and then checking whether a parameter with a matching ID was added to the APVTS.

1 Like

Thank you! You are right. Two properties were missed.
As I understand, previously it wasn’t required.