SoundFile.cpp: do a NULL check before deferencing.
CID 296.
This commit is contained in:
@@ -310,7 +310,7 @@ status_t
|
||||
BSoundFile::_ref_to_file(const entry_ref *ref)
|
||||
{
|
||||
status_t status;
|
||||
BFile * file = new BFile(ref,B_READ_ONLY);
|
||||
BFile * file = new BFile(ref, B_READ_ONLY);
|
||||
status = file->InitCheck();
|
||||
if (status != B_OK) {
|
||||
fSoundFile = file;
|
||||
@@ -360,6 +360,10 @@ BSoundFile::_ref_to_file(const entry_ref *ref)
|
||||
if (mf.type == B_MEDIA_RAW_AUDIO) {
|
||||
raw = &mf.u.raw_audio;
|
||||
}
|
||||
|
||||
if (raw == NULL)
|
||||
return B_ERROR;
|
||||
|
||||
fSamplingRate = (int)raw->frame_rate;
|
||||
fChannelCount = raw->channel_count;
|
||||
fSampleSize = raw->format & 0xf;
|
||||
|
||||
Reference in New Issue
Block a user