# Missing sanity check in audio processor's parameter related methods

**URL:** <https://forum.juce.com/t/missing-sanity-check-in-audio-processors-parameter-related-methods/27281>\
**Category:** General JUCE discussion\
**Created:** [April 17, 2018, 2:03pm UTC](https://forum.juce.com/t/missing-sanity-check-in-audio-processors-parameter-related-methods/27281 "2018-04-17T14:03:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![frousse](https://avatars.discourse-cdn.com/v4/letter/f/c2a13f/32.png) [@frousse](https://forum.juce.com/u/frousse)\
**Post date:** [April 17, 2018, 2:03pm UTC](https://forum.juce.com/t/missing-sanity-check-in-audio-processors-parameter-related-methods/27281/1 "2018-04-17T14:03:31Z")

</div>

Hi,  
I recently stopped inheriting from the parameter methods to use juce::AudioProcessorParameter instead in my audioProcessor (at last 😁).  
It seems the AudioProcessor::getParameterText method (as well as other methods) assumes the host always calls the audioProcessor with a valid index. As the host is often a third party software, we have no control over its behavior.  
So I would be nice to have some sanity check to prevent that kind of issue:

 ![15](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/e/ede065748e791417235214d039911adad0318d6e.png)  
Here is the call stack:  
 ![10](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/3/3e6193ef29d7eaa4da5cfb128de9518faacb1f1b.png)  
Which ends up by a SIGSEGV.  
To trigger this I restored a session with ableton live 10 after removing some of my audio processor’s parameters. Live seems to assume that the number of parameter of a plugin does not change from a session to another.  
Thanks.

---

<div class="post-metadata">

**Author:** ![holy-city](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@holy-city](https://forum.juce.com/u/holy-city)\
**Post date:** [April 17, 2018, 5:32pm UTC](https://forum.juce.com/t/missing-sanity-check-in-audio-processors-parameter-related-methods/27281/2 "2018-04-17T17:32:56Z")

</div>

> Live seems to assume that the number of parameter of a plugin does not change from a session to another.

I think every DAW makes that assumption, changing parameter indices will break automation across the the board. A sanity check makes sense for debugging, but parameter indices should really never change. EDIT: The number of parameters needs to be fixed at compile time as well (or rather, you can’t dynamically change the number of parameters willy-nilly, most APIs don’t support removing parameters)

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [April 17, 2018, 5:35pm UTC](https://forum.juce.com/t/missing-sanity-check-in-audio-processors-parameter-related-methods/27281/3 "2018-04-17T17:35:23Z")

</div>

Yes, JUCE doesn’t support changing the number of parameters dynamically because even when the plug-in format allows it host support is pretty patchy.

I’ll make those functions safer anyway.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [April 17, 2018, 6:46pm UTC](https://forum.juce.com/t/missing-sanity-check-in-audio-processors-parameter-related-methods/27281/4 "2018-04-17T18:46:52Z")

</div>

> <https://github.com/WeAreROLI/JUCE/commit/fd73d77484ae6c4bdbc10a974d4bf6512db0d10e>
