From e32494d24f18264d7aaee5acfed3b75b3bea4c60 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 25 Sep 2008 13:56:50 +0000 Subject: [PATCH] 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 --- src/servers/media_addon/MediaFilePlayer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/servers/media_addon/MediaFilePlayer.cpp b/src/servers/media_addon/MediaFilePlayer.cpp index a9ab0cc8ce..51e5a613a6 100644 --- a/src/servers/media_addon/MediaFilePlayer.cpp +++ b/src/servers/media_addon/MediaFilePlayer.cpp @@ -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) {