[pango/no-font-fixes: 1/3] fonts: Handle lack of fonts
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/no-font-fixes: 1/3] fonts: Handle lack of fonts
- Date: Tue, 27 Sep 2022 00:46:11 +0000 (UTC)
commit b7666befa248ea0cb9716b8e3c3e6b43e9f15ccf
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Sep 26 20:22:44 2022 -0400
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 e7bd47805..47671424c 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]