mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added some null pointer checks to createWriterFor methods
This commit is contained in:
parent
400cd0e3f4
commit
3b881401f1
5 changed files with 11 additions and 4 deletions
|
|
@ -1003,7 +1003,7 @@ AudioFormatWriter* AiffAudioFormat::createWriterFor (OutputStream* out,
|
|||
const StringPairArray& metadataValues,
|
||||
int /*qualityOptionIndex*/)
|
||||
{
|
||||
if (getPossibleBitDepths().contains (bitsPerSample))
|
||||
if (out != nullptr && getPossibleBitDepths().contains (bitsPerSample))
|
||||
return new AiffAudioFormatWriter (out, sampleRate, numberOfChannels, (unsigned int) bitsPerSample, metadataValues);
|
||||
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out,
|
|||
const StringPairArray& /*metadataValues*/,
|
||||
int qualityOptionIndex)
|
||||
{
|
||||
if (getPossibleBitDepths().contains (bitsPerSample))
|
||||
if (out != nullptr && getPossibleBitDepths().contains (bitsPerSample))
|
||||
{
|
||||
ScopedPointer<FlacWriter> w (new FlacWriter (out, sampleRate, numberOfChannels,
|
||||
(uint32) bitsPerSample, qualityOptionIndex));
|
||||
|
|
|
|||
|
|
@ -205,6 +205,9 @@ AudioFormatWriter* LAMEEncoderAudioFormat::createWriterFor (OutputStream* stream
|
|||
const StringPairArray& metadataValues,
|
||||
int qualityOptionIndex)
|
||||
{
|
||||
if (streamToWriteTo == nullptr)
|
||||
return nullptr;
|
||||
|
||||
int vbr = 4;
|
||||
int cbr = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -483,8 +483,12 @@ AudioFormatWriter* OggVorbisAudioFormat::createWriterFor (OutputStream* out,
|
|||
const StringPairArray& metadataValues,
|
||||
int qualityOptionIndex)
|
||||
{
|
||||
if (out == nullptr)
|
||||
return nullptr;
|
||||
|
||||
ScopedPointer<OggWriter> w (new OggWriter (out, sampleRate, numChannels,
|
||||
(unsigned int) bitsPerSample, qualityOptionIndex, metadataValues));
|
||||
(unsigned int) bitsPerSample,
|
||||
qualityOptionIndex, metadataValues));
|
||||
|
||||
return w->ok ? w.release() : nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1606,7 +1606,7 @@ AudioFormatWriter* WavAudioFormat::createWriterFor (OutputStream* out, double sa
|
|||
unsigned int numChannels, int bitsPerSample,
|
||||
const StringPairArray& metadataValues, int /*qualityOptionIndex*/)
|
||||
{
|
||||
if (getPossibleBitDepths().contains (bitsPerSample))
|
||||
if (out != nullptr && getPossibleBitDepths().contains (bitsPerSample))
|
||||
return new WavAudioFormatWriter (out, sampleRate, (unsigned int) numChannels,
|
||||
(unsigned int) bitsPerSample, metadataValues);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue