From ab173b8e64a27aa66a16da06ca4c3d8088af5b57 Mon Sep 17 00:00:00 2001 From: "kmcclusk%netscape.com" Date: Tue, 25 May 1999 19:37:16 +0000 Subject: [PATCH] patch for #bug 6934. Checkin approved by Chris Hofmann. Added check to nsTitledButtonFrame::DisplayAltFeedback to verify the icon returned from LoadIconImage for is not null. This will prevent aRenderingContext.DrawImage from being passed a null aImage parameter. --- layout/xul/base/src/nsTitledButtonFrame.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/layout/xul/base/src/nsTitledButtonFrame.cpp b/layout/xul/base/src/nsTitledButtonFrame.cpp index 34dd0fc66ee1..e7ab0a879dc6 100644 --- a/layout/xul/base/src/nsTitledButtonFrame.cpp +++ b/layout/xul/base/src/nsTitledButtonFrame.cpp @@ -747,15 +747,20 @@ nsTitledButtonFrame::DisplayAltFeedback(nsIPresContext& aPresContext, nsIImage* icon; if (NS_SUCCEEDED(dc->LoadIconImage(aIconId, icon))) { - aRenderingContext.DrawImage(icon, inner.x, inner.y); + //XXX: #bug 6934 check for null icon as a patch + //A question remains, why does LoadIconImage above, sometimes + //return a null icon. + if (nsnull != icon) { + aRenderingContext.DrawImage(icon, inner.x, inner.y); - // Reduce the inner rect by the width of the icon, and leave an - // additional six pixels padding - PRInt32 iconWidth = NSIntPixelsToTwips(icon->GetWidth() + 6, p2t); - inner.x += iconWidth; - inner.width -= iconWidth; + // Reduce the inner rect by the width of the icon, and leave an + // additional six pixels padding + PRInt32 iconWidth = NSIntPixelsToTwips(icon->GetWidth() + 6, p2t); + inner.x += iconWidth; + inner.width -= iconWidth; - NS_RELEASE(icon); + NS_RELEASE(icon); + } } NS_RELEASE(dc);