Bug 688516 - Null check mElement before use in NotifyDownloadEnded and AudioAvailable. r=cpearce

This commit is contained in:
Matthew Gregan 2011-09-23 16:27:18 +12:00
parent 0093ca222c
commit fea58fa8d1
2 changed files with 6 additions and 5 deletions

View File

@ -402,7 +402,7 @@ void nsBuiltinDecoder::AudioAvailable(float* aFrameBuffer,
return;
}
if (!mElement->MayHaveAudioAvailableEventListener()) {
if (!mElement || !mElement->MayHaveAudioAvailableEventListener()) {
return;
}
@ -442,8 +442,7 @@ void nsBuiltinDecoder::MetadataLoaded(PRUint32 aChannels,
if (!mResourceLoaded) {
StartProgress();
}
else if (mElement) {
} else if (mElement) {
// Resource was loaded during metadata loading, when progress
// events are being ignored. Fire the final progress event.
mElement->DispatchAsyncEvent(NS_LITERAL_STRING("progress"));
@ -664,7 +663,9 @@ void nsBuiltinDecoder::NotifyDownloadEnded(nsresult aStatus)
if (aStatus == NS_BINDING_ABORTED) {
// Download has been cancelled by user.
mElement->LoadAborted();
if (mElement) {
mElement->LoadAborted();
}
return;
}

View File

@ -71,7 +71,7 @@ static const PRUint32 STALL_MS = 3000;
static const PRInt64 CAN_PLAY_THROUGH_MARGIN = 10;
nsMediaDecoder::nsMediaDecoder() :
mElement(0),
mElement(nsnull),
mRGBWidth(-1),
mRGBHeight(-1),
mVideoUpdateLock("nsMediaDecoder.mVideoUpdateLock"),