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);