Dylan Smith : richedit: Prevent uninitialized value from being used.
Alexandre Julliard
julliard at winehq.org
Mon Jan 25 11:21:09 CST 2010
Module: wine
Branch: master
Commit: 530a6c459837a7a77d89c96cfe3439e1e6680920
URL: http://source.winehq.org/git/wine.git/?a=commit;h=530a6c459837a7a77d89c96cfe3439e1e6680920
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Mon Jan 25 01:27:24 2010 -0500
richedit: Prevent uninitialized value from being used.
NULL may be returned by ITextHost::TxGetDC. Caught by valgrind.
---
dlls/riched20/run.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 90ea831..cd282ec 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -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;
+ }
}
/******************************************************************************
More information about the wine-cvs
mailing list