[gnome-font-viewer] Fix a crash when no sample string can be constructed
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-font-viewer] Fix a crash when no sample string can be constructed
- Date: Sat, 21 Nov 2015 22:23:48 +0000 (UTC)
commit 1af4733223882c8870040c6333117ade116cbbac
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Nov 21 14:21:53 2015 -0800
Fix a crash when no sample string can be constructed
When no sample string can be constructed, we end up trying to measure a
NULL string, leading to a crash.
While the user experience when no string can be constructed using the
glyphs available in the specified font can be improved, at least avoid a
crash here.
https://bugzilla.gnome.org/show_bug.cgi?id=757680
src/sushi-font-widget.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/sushi-font-widget.c b/src/sushi-font-widget.c
index 1b7febd..3709db5 100644
--- a/src/sushi-font-widget.c
+++ b/src/sushi-font-widget.c
@@ -636,7 +636,8 @@ sushi_font_widget_draw (GtkWidget *drawing_area,
for (i = 0; i < n_sizes; i++) {
cairo_set_font_size (cr, sizes[i]);
- draw_string (self, cr, padding, self->priv->sample_string, &pos_y);
+ if (self->priv->sample_string != NULL)
+ draw_string (self, cr, padding, self->priv->sample_string, &pos_y);
if (pos_y > allocated_height)
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]