richedit: Prevent uninitialized value from being used.

NULL may be returned by ITextHost::TxGetDC. Caught by valgrind.
oldstable
Dylan Smith 2010-01-25 01:27:24 -05:00 committed by Alexandre Julliard
parent 352ae8b480
commit 530a6c4598
1 changed files with 8 additions and 3 deletions

View File

@ -550,9 +550,14 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
static void ME_GetTextExtent(ME_Context *c, LPCWSTR szText, int nChars, ME_Style *s, SIZE *size)
{
HGDIOBJ hOldFont;
hOldFont = ME_SelectStyleFont(c, s);
GetTextExtentPoint32W(c->hDC, szText, nChars, size);
ME_UnselectStyleFont(c, s, hOldFont);
if (c->hDC) {
hOldFont = ME_SelectStyleFont(c, s);
GetTextExtentPoint32W(c->hDC, szText, nChars, size);
ME_UnselectStyleFont(c, s, hOldFont);
} else {
size->cx = 0;
size->cy = 0;
}
}
/******************************************************************************