Files
pango/639.patch

35 lines
1.2 KiB
Diff

From 2771f621ed31deeae6c7ad984db1e5aa33f08a3c Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Thu, 22 Sep 2022 16:12:37 -0700
Subject: [PATCH] layout: Fix crash when no font is installed
Fixes: https://gitlab.gnome.org/GNOME/pango/-/issues/701
---
pango/pango-layout.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index a1c472039..b8eeede00 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -5707,13 +5707,14 @@ pango_layout_run_get_extents_and_height (PangoLayoutRun *run,
}
else
{
- double xscale, yscale;
+ double xscale = 0, yscale = 0;
if (!metrics)
metrics = pango_font_get_metrics (run->item->analysis.font,
run->item->analysis.language);
- pango_font_get_scale_factors (run->item->analysis.font, &xscale, &yscale);
+ if (G_LIKELY(run->item->analysis.font))
+ pango_font_get_scale_factors (run->item->analysis.font, &xscale, &yscale);
*height = pango_font_metrics_get_height (metrics) * MAX (xscale, yscale);
}
}
--
GitLab