incorrect object checking; testing against 0 (NULL) instead of nsnull

RESOLVED INVALID

Status

()

RESOLVED INVALID
11 years ago
11 years ago

People

(Reporter: rcoe, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008051202 Firefox/3.0
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008051202 Firefox/3.0

In the code below, the first if-statement is never executed because mFrame
is the opaque object 'nsnull'.  I'm not sure what do_CreateInstance
returns in a failure case, but appears based on usage 'NULL'.

There appear to be similar errors with mImageFrame in 
    modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp, there may be others.

modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp
 470     mImage->GetFrameAt(0, getter_AddRefs(mFrame));
 471 
 472     PRBool createNewFrame = PR_TRUE;
 473
 474     if (mFrame) {
[...]
 485     } 
[...]
 489       if (!mFrame) {


Reproducible: Always
(Reporter)

Updated

11 years ago
Version: unspecified → Trunk
(Reporter)

Comment 1

11 years ago
There's similar usage here:

gfx/src/thebes/nsThebesImage.cpp
334     if (mOptSurface == nsnull)
335         mOptSurface = gfxPlatform::GetPlatform()->OptimizeImage(mImageSurface, mFormat);
336 
337     if (mOptSurface) {
338         mImageSurface = nsnull;
Status: UNCONFIRMED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.