diff options
author | Christian Hergert <christian@hergert.me> | 2015-09-01 02:02:31 -0700 |
---|---|---|
committer | Christian Hergert <christian@hergert.me> | 2015-09-01 02:02:31 -0700 |
commit | 1e0936784af928282dc9a4513aacb805d0ccab2e (patch) | |
tree | 6d6f6bede838724a1cda0a8ddcf3d2e4d870f82c | |
parent | b58ab9446e1c2c14bfe74ae6eea0d59e600385b1 (diff) | |
download | gtksourceview-1e0936784af928282dc9a4513aacb805d0ccab2e.tar.gz |
sourceview: fix potential divide-by-zero in grid drawing
I happened to run into this while manually typing in font-sizing in CSS
using the Gtk inspector. Quick, easy fix.
-rw-r--r-- | gtksourceview/gtksourceview.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c index 7c790604..cd34ecc8 100644 --- a/gtksourceview/gtksourceview.c +++ b/gtksourceview/gtksourceview.c @@ -2815,7 +2815,8 @@ gtk_source_view_paint_background_pattern_grid (GtkSourceView *view, g_object_unref (layout); /* each character becomes 2 stacked boxes. */ - grid_height /= 2; + grid_height = MAX (1, grid_height / 2); + grid_width = MAX (1, grid_width); cairo_save (cr); |