[gtksourceview] sourceview: fix potential divide-by-zero in grid drawing



commit 1e0936784af928282dc9a4513aacb805d0ccab2e
Author: Christian Hergert <christian hergert me>
Date:   Tue Sep 1 02:02:31 2015 -0700

    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.

 gtksourceview/gtksourceview.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 7c79060..cd34ecc 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]