From fb39cfe3e07e2a8e0f80f2bc4ae31f59a4d2ad99 Mon Sep 17 00:00:00 2001 From: Dmitry Karasik Date: Thu, 19 Sep 2024 18:02:01 +0200 Subject: [PATCH] experimental: validate input for font_pick(NULL) --- unix/font.c | 5 ++--- win32/stock.c | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/unix/font.c b/unix/font.c index 0cecc15dc..2b8d03440 100644 --- a/unix/font.c +++ b/unix/font.c @@ -589,10 +589,9 @@ prima_font_pick( PFont source, Matrix matrix, PFont dest, unsigned int selection if ( selection == 0 ) selection = FONTKEY_DEFAULT; - if ( dest != NULL ) - Drawable_font_add( NULL_HANDLE, source, dest ); - else + if ( dest == NULL ) dest = source; + Drawable_font_add( NULL_HANDLE, source, dest ); #ifdef USE_FONTQUERY if ( selection & FONTKEY_FREETYPE ) diff --git a/win32/stock.c b/win32/stock.c index 6da1156fd..906935f4b 100644 --- a/win32/stock.c +++ b/win32/stock.c @@ -1573,8 +1573,10 @@ apc_font_pick( Handle self, PFont source, PFont dest) if ( dest != NULL ) { Drawable_font_add( NULL_HANDLE, source, dest ); source = dest; - } else + } else { dest = source; + Drawable_font_add( NULL_HANDLE, source, dest ); + } if ( self && is_opt(optInFontQuery)) res.x = res.y = 72; else