1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Prevent NULL-dereferencing segfaults when the font selector is

invoked with no valid font in the input text.

[originally from svn r7952]
This commit is contained in:
Simon Tatham 2008-03-29 13:59:31 +00:00
parent 0527d54f03
commit f07f782547

View File

@ -1474,15 +1474,18 @@ static void unifontsel_set_filter_buttons(unifontsel_internal *fs)
static void unifontsel_draw_preview_text(unifontsel_internal *fs)
{
unifont *font;
char *sizename;
char *sizename = NULL;
fontinfo *info = fs->selected;
sizename = info->fontclass->scale_fontname
(GTK_WIDGET(fs->u.window), info->realname, fs->selsize);
if (info) {
sizename = info->fontclass->scale_fontname
(GTK_WIDGET(fs->u.window), info->realname, fs->selsize);
font = info->fontclass->create(GTK_WIDGET(fs->u.window),
sizename ? sizename : info->realname,
FALSE, FALSE, 0, 0);
} else
font = NULL;
font = info->fontclass->create(GTK_WIDGET(fs->u.window),
sizename ? sizename : info->realname,
FALSE, FALSE, 0, 0);
if (fs->preview_pixmap) {
GdkGC *gc = gdk_gc_new(fs->preview_pixmap);
gdk_gc_set_foreground(gc, &fs->preview_bg);