From e8cdc65357f553521cb2dac3451a822360fd9e01 Mon Sep 17 00:00:00 2001 From: Timur Doumler Date: Wed, 5 Oct 2016 13:06:26 +0100 Subject: [PATCH] Fixed Array::remove (ElementType*) so that if given an invalid pointer, it doesn't attempt to remove anything after the assert. --- modules/juce_core/containers/juce_Array.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/juce_core/containers/juce_Array.h b/modules/juce_core/containers/juce_Array.h index b5881b86b2..3b673c2019 100644 --- a/modules/juce_core/containers/juce_Array.h +++ b/modules/juce_core/containers/juce_Array.h @@ -853,7 +853,12 @@ public: jassert (data.elements != nullptr); const int indexToRemove = int (elementToRemove - data.elements); - jassert (isPositiveAndBelow (indexToRemove, numUsed)); + + if (! isPositiveAndBelow (indexToRemove, numUsed)) + { + jassertfalse; + return; + } removeInternal (indexToRemove); }