From d12799a8f25befc1cfbb1228d5bb878282a37c3e Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Tue, 1 May 2001 02:53:27 +0000 Subject: [PATCH] fixing bug 78109 r=jband sr=brendan --- modules/libpr0n/src/imgRequest.cpp | 6 +++++- modules/libpr0n/src/imgRequest.h | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/libpr0n/src/imgRequest.cpp b/modules/libpr0n/src/imgRequest.cpp index 14f70269593..8f6b4c488be 100644 --- a/modules/libpr0n/src/imgRequest.cpp +++ b/modules/libpr0n/src/imgRequest.cpp @@ -429,6 +429,9 @@ NS_IMETHODIMP imgRequest::OnStartContainer(imgIRequest *request, nsISupports *cx { LOG_SCOPE(gImgLog, "imgRequest::OnStartContainer"); + NS_ASSERTION(image, "imgRequest::OnStartContainer called with a null image!"); + if (!image) return NS_ERROR_UNEXPECTED; + mState |= onStartContainer; mStatus |= imgIRequest::STATUS_SIZE_AVAILABLE; @@ -629,7 +632,8 @@ NS_IMETHODIMP imgRequest::OnStopRequest(nsIRequest *aRequest, nsISupports *ctxt, mChannel = nsnull; // we no longer need the channel } - if (NS_FAILED(status)) { + // If mImage is still null, we didn't properly load the image. + if (NS_FAILED(status) || !mImage) { this->Cancel(status); // sets status, stops animations, removes from cache } else { mStatus |= imgIRequest::STATUS_LOAD_COMPLETE; diff --git a/modules/libpr0n/src/imgRequest.h b/modules/libpr0n/src/imgRequest.h index 6aab8fac773..1d442d75d84 100644 --- a/modules/libpr0n/src/imgRequest.h +++ b/modules/libpr0n/src/imgRequest.h @@ -56,11 +56,11 @@ class imgRequestProxy; } enum { - onStartDecode = 0x01, - onStartContainer = 0x02, - onStopContainer = 0x04, - onStopDecode = 0x08, - onStopRequest = 0x16 + onStartDecode = PR_BIT(0), + onStartContainer = PR_BIT(1), + onStopContainer = PR_BIT(2), + onStopDecode = PR_BIT(3), + onStopRequest = PR_BIT(4) }; class imgRequest : public imgIRequest,