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:
Stefano Ceccherini 2008-09-25 13:56:50 +00:00
parent 717326c223
commit e32494d24f

View File

@ -70,6 +70,8 @@ MediaFilePlayer::MediaFilePlayer(const char *media_type,
for (int i=0; i < fPlayFile->CountTracks(); i++) {
BMediaTrack *track = fPlayFile->TrackAt(i);
if (track == NULL)
continue;
fPlayFormat.type = B_MEDIA_RAW_AUDIO;
fPlayFormat.u.raw_audio.buffer_size = 256;
if ((track->DecodedFormat(&fPlayFormat) == B_OK)
@ -77,8 +79,7 @@ MediaFilePlayer::MediaFilePlayer(const char *media_type,
fPlayTrack = track;
break;
}
if (track)
fPlayFile->ReleaseTrack(track);
fPlayFile->ReleaseTrack(track);
}
if (fPlayTrack == NULL) {