Check for NULL before dereferencing the pointer. CID 1050
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27741 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -70,6 +70,8 @@ MediaFilePlayer::MediaFilePlayer(const char *media_type,
|
|||||||
|
|
||||||
for (int i=0; i < fPlayFile->CountTracks(); i++) {
|
for (int i=0; i < fPlayFile->CountTracks(); i++) {
|
||||||
BMediaTrack *track = fPlayFile->TrackAt(i);
|
BMediaTrack *track = fPlayFile->TrackAt(i);
|
||||||
|
if (track == NULL)
|
||||||
|
continue;
|
||||||
fPlayFormat.type = B_MEDIA_RAW_AUDIO;
|
fPlayFormat.type = B_MEDIA_RAW_AUDIO;
|
||||||
fPlayFormat.u.raw_audio.buffer_size = 256;
|
fPlayFormat.u.raw_audio.buffer_size = 256;
|
||||||
if ((track->DecodedFormat(&fPlayFormat) == B_OK)
|
if ((track->DecodedFormat(&fPlayFormat) == B_OK)
|
||||||
@@ -77,8 +79,7 @@ MediaFilePlayer::MediaFilePlayer(const char *media_type,
|
|||||||
fPlayTrack = track;
|
fPlayTrack = track;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (track)
|
fPlayFile->ReleaseTrack(track);
|
||||||
fPlayFile->ReleaseTrack(track);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fPlayTrack == NULL) {
|
if (fPlayTrack == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user