Dynamically adding Curve EQ with Effect Slot Save Preset Problem.
- 
 Hello! I'm having an issue with, adding and removing dynamically the Curve EQ using the Effect Slot processor. I think my problem is in this function. -> inline function oncmbFxControl(component, value) { local index = cmbFxSlot.indexOf(component); local fxType = cmbFxSlot[index].getItemText(); if (fxType == "Empty") fxSlot[index].setEffect("EmptyFX"); else fxSlot[index].setEffect(fxType); btnShowPanel[index].setValue(1); btnShowPanel[index].changed(); if (fxType == "CurveEq") { local tileData = { "Type": "DraggableFilterPanel", "ProcessorId": "fx"+index+"_CurveEq", "Index": -1 }; //Console.print(index); showFltFxEq(index); fltFxEq[index].setContentData(tileData); Engine.addModuleStateToUserPreset("fx"+index+"_CurveEq"); } };I think the problem is here -> Engine.addModuleStateToUserPreset("fx"+index+"_CurveEq");When I save a preset with a CurveEQ it works. If I change the combobox to Empty and Save Preset then I get a crash. Exception thrown: read access violation. p was nullptr.juce::ValueTree UserPresetHelpers::createModuleStateTree(ModulatorSynthChain* chain) { ValueTree modules("Modules"); if (auto sp = JavascriptMidiProcessor::getFirstInterfaceScriptProcessor(chain->getMainController())) { for (auto id : sp->getListOfModuleIds()) { auto p = ProcessorHelpers::getFirstProcessorWithName(chain, id); auto mTree = p->exportAsValueTree(); mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr); mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr); modules.addChild(mTree, -1, nullptr); } } return modules; }So I tried this in the source code -> juce::ValueTree UserPresetHelpers::createModuleStateTree(ModulatorSynthChain* chain) { ValueTree modules("Modules"); if (auto sp = JavascriptMidiProcessor::getFirstInterfaceScriptProcessor(chain->getMainController())) { for (auto id : sp->getListOfModuleIds()) { auto p = ProcessorHelpers::getFirstProcessorWithName(chain, id); if (p != nullptr) { auto mTree = p->exportAsValueTree(); mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr); mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr); modules.addChild(mTree, -1, nullptr); } } }Hise is not crashing anymore but I think my fix breaks it in some other way. IN CONCLUSION (lol) I think this nullptr problem is caused by .addModuleStateToUserPreset once I Save my combobox with Empty after setting it to CurveEq. I don't have this problem with other FX. Is there a way to remove addModuleStateToUserPreset - removeModuleStateToUserPreset or something similar? Maybe this will solve my problem. Cheers! 
- 
 UPDATE with juce::ValueTree UserPresetHelpers::createModuleStateTree(ModulatorSynthChain* chain) { ValueTree modules("Modules"); if (auto sp = JavascriptMidiProcessor::getFirstInterfaceScriptProcessor(chain->getMainController())) { for (auto id : sp->getListOfModuleIds()) { auto p = ProcessorHelpers::getFirstProcessorWithName(chain, id); if (p != nullptr) { auto mTree = p->exportAsValueTree(); mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr); mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr); modules.addChild(mTree, -1, nullptr); } } }It does work! But I need to click twice to recall the CurveEq values if coming from Empty Slot or other FX. If I'm already on a CureveEq then it loads on first attempt -> 