Browse Source

ArrayBase: Avoid undefined behaviour when trying to copy a range of 0 elements

v6.1.6
reuk 4 years ago
parent
commit
22189f7aa4
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      modules/juce_core/containers/juce_ArrayBase.h

+ 2
- 1
modules/juce_core/containers/juce_ArrayBase.h View File

@@ -402,7 +402,8 @@ private:
template <typename T = ElementType>
TriviallyCopyableVoid<T> addArrayInternal (const ElementType* otherElements, int numElements)
{
memcpy (elements + numUsed, otherElements, (size_t) numElements * sizeof (ElementType));
if (numElements > 0)
memcpy (elements + numUsed, otherElements, (size_t) numElements * sizeof (ElementType));
}
template <typename Type, typename T = ElementType>


Loading…
Cancel
Save