diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h index e82dd5269f..991e983caf 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h @@ -1167,6 +1167,15 @@ private: allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32; allocatedData.malloc (allocatedBytes); + + if (allocatedData.get() == nullptr) + { + // Allocation failure! + jassertfalse; + allocatedBytes = 0; + return; + } + channels = unalignedPointerCast (allocatedData.get()); auto chan = unalignedPointerCast (allocatedData + channelListSize); @@ -1237,7 +1246,7 @@ private: int numChannels = 0, size = 0; size_t allocatedBytes = 0; - Type** channels; + Type** channels = nullptr; HeapBlock allocatedData; Type* preallocatedChannelSpace[32]; bool isClear = false;