diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index 199b7a620b..efd4a7a9c1 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -304,7 +304,7 @@ public: } else { - if (index < 0) + if (! isPositiveAndBelow (index, children.size())) index = children.size(); undoManager->perform (new AddOrRemoveChildAction (this, index, child));