From b7666befa248ea0cb9716b8e3c3e6b43e9f15ccf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 26 Sep 2022 20:22:44 -0400 Subject: fonts: Handle lack of fonts Make pango_font_get_scale_factors return 1 if the font is NULL. This avoids crashes in situations where we cannot find any fonts. Fixes: #701 --- pango/fonts.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pango/fonts.c b/pango/fonts.c index e7bd4780..47671424 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -2871,5 +2871,11 @@ pango_font_get_scale_factors (PangoFont *font, double *x_scale, double *y_scale) { + if (G_UNLIKELY (!font)) + { + *x_scale = *y_scale = .1; + return; + } + PANGO_FONT_GET_CLASS_PRIVATE (font)->get_scale_factors (font, x_scale, y_scale); } -- cgit v1.2.1