diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2015-11-21 14:21:53 -0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2015-11-21 14:23:25 -0800 |
commit | 1af4733223882c8870040c6333117ade116cbbac (patch) | |
tree | 1a9dac6d290d968ba4f7d838668ac897ed2189a3 | |
parent | dcc436b7cdb08beb07144ee55d96f32b065d47f6 (diff) | |
download | gnome-font-viewer-1af4733223882c8870040c6333117ade116cbbac.tar.gz |
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
-rw-r--r-- | 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; } |