Bug 513681 - part 12 - Ensure that IsDecodeFinished() is only called with a non-null decoder.r=joe,a=blocker

This commit is contained in:
Bobby Holley 2010-08-14 11:31:27 -04:00
parent 88253260c1
commit 33b695f06d

View File

@ -2501,9 +2501,14 @@ RasterImage::DecodeSomeData(PRUint32 aMaxBytes)
// There are various indicators that tell us we're finished with the decode
// task at hand and can shut down the decoder.
//
// This method may not be called if there is no decoder.
PRBool
RasterImage::IsDecodeFinished()
{
// Precondition
NS_ABORT_IF_FALSE(mDecoder, "Can't call IsDecodeFinished() without decoder!");
// Assume it's not finished
PRBool decodeFinished = PR_FALSE;
@ -2643,7 +2648,7 @@ imgDecodeWorker::Run()
// If Conditions 1 & 2 are still true, then the only reason we bailed was
// because we hit the deadline. Repost ourselves to the end of the event
// queue.
if (!image->IsDecodeFinished() && haveMoreData)
if (image->mDecoder && !image->IsDecodeFinished() && haveMoreData)
return this->Dispatch();
// Otherwise, return success