From 60c1ae0bb8f68acc43153b91c5ec05fc89427730 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 2 Nov 2005 20:51:16 +0000 Subject: [PATCH] Fixed crash in font browsing for raster fonts. --- programs/wineconsole/dialog.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/programs/wineconsole/dialog.c b/programs/wineconsole/dialog.c index 3e4abb4cc3e..b9de53176ea 100644 --- a/programs/wineconsole/dialog.c +++ b/programs/wineconsole/dialog.c @@ -393,9 +393,14 @@ static int CALLBACK font_enum_size(const LOGFONT* lf, const TEXTMETRIC* tm, SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, idx, (LPARAM)buf); /* now grow our arrays and insert the values at the same index than in the list box */ - di->font = HeapReAlloc(GetProcessHeap(), 0, di->font, sizeof(*di->font) * (di->nFont + 1)); - if (idx != di->nFont) - memmove(&di->font[idx + 1], &di->font[idx], (di->nFont - idx) * sizeof(*di->font)); + if (di->nFont) + { + di->font = HeapReAlloc(GetProcessHeap(), 0, di->font, sizeof(*di->font) * (di->nFont + 1)); + if (idx != di->nFont) + memmove(&di->font[idx + 1], &di->font[idx], (di->nFont - idx) * sizeof(*di->font)); + } + else + di->font = HeapAlloc(GetProcessHeap(), 0, sizeof(*di->font)); di->font[idx].height = tm->tmHeight; di->font[idx].weight = tm->tmWeight; lstrcpy(di->font[idx].faceName, lf->lfFaceName);