fix crasher bug 110898 by doing a null check before deferencing a pointer that can be null in extreme situations where a font could not be realized, r=shanjian, sr=attinasi, a=shaver
git-svn-id: svn://10.0.0.236/trunk@115398 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
e7b9cff695
commit
c1929b9f84
@ -2061,12 +2061,16 @@ nsRenderingContextWin::GetTextDimensions(const PRUnichar* aString,
|
|||||||
aLastWordDimensions.Clear();
|
aLastWordDimensions.Clear();
|
||||||
aLastWordDimensions.width = -1;
|
aLastWordDimensions.width = -1;
|
||||||
|
|
||||||
|
PRInt32 count = fonts.Count();
|
||||||
|
if (!count)
|
||||||
|
return NS_OK;
|
||||||
nsFontWin* fontWin = (nsFontWin*)fonts[0];
|
nsFontWin* fontWin = (nsFontWin*)fonts[0];
|
||||||
|
NS_ASSERTION(fontWin, "internal error in do_BreakGetTextDimensions");
|
||||||
aDimensions.ascent = fontWin->mMaxAscent;
|
aDimensions.ascent = fontWin->mMaxAscent;
|
||||||
aDimensions.descent = fontWin->mMaxDescent;
|
aDimensions.descent = fontWin->mMaxDescent;
|
||||||
|
|
||||||
// fast path - normal case, quick return if there is only one font
|
// fast path - normal case, quick return if there is only one font
|
||||||
if (fonts.Count() == 1)
|
if (count == 1)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// get the last break index.
|
// get the last break index.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user