From cb60c36d8973f844c4d760b170e73453048b6df2 Mon Sep 17 00:00:00 2001 From: "jfrancis%netscape.com" Date: Tue, 19 Jan 1999 02:05:53 +0000 Subject: [PATCH] adding checks for null mContext member in a couple of places - fixes bug #2200 git-svn-id: svn://10.0.0.236/trunk@17985 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/mac/nsRenderingContextMac.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mozilla/gfx/src/mac/nsRenderingContextMac.cpp b/mozilla/gfx/src/mac/nsRenderingContextMac.cpp index 3256077b8e9..9466c5f0186 100644 --- a/mozilla/gfx/src/mac/nsRenderingContextMac.cpp +++ b/mozilla/gfx/src/mac/nsRenderingContextMac.cpp @@ -488,8 +488,9 @@ void nsRenderingContextMac::SelectDrawingSurface(DrawingSurface* aSurface) if (mGS->mFontMetrics) SetFont(mGS->mFontMetrics); - - + + if (!mContext) return; + // GS and context initializations ((nsDeviceContextMac *)mContext)->SetDrawingSurface(mPort); #if 0 @@ -521,6 +522,11 @@ NS_IMETHODIMP nsRenderingContextMac::SetPortTextState() if (nsnull == mGS->mFontMetrics) return NS_ERROR_NULL_POINTER; + NS_PRECONDITION(mContext != nsnull, "No device context in SetPortTextState"); + + if (nsnull == mContext) + return NS_ERROR_NULL_POINTER; + TextStyle theStyle; nsFontMetricsMac::GetNativeTextStyle(*mGS->mFontMetrics, *mContext, theStyle);