[gitg] Fix size calculation if there is no old pixbuf



commit 2b8f2e1175608efd06f08bf220234ea2cec48c69
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Mon Aug 29 05:40:34 2016 +0200

    Fix size calculation if there is no old pixbuf

 libgitg/gitg-diff-image-composite.vala |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/libgitg/gitg-diff-image-composite.vala b/libgitg/gitg-diff-image-composite.vala
index 0a7c2c3..f888d5a 100644
--- a/libgitg/gitg-diff-image-composite.vala
+++ b/libgitg/gitg-diff-image-composite.vala
@@ -24,6 +24,15 @@ class Gitg.DiffImageComposite : Gtk.DrawingArea
        private void get_natural_size(out int image_width, out int image_height)
        {
                var pixbuf = cache.old_pixbuf;
+
+               if (pixbuf == null)
+               {
+                       image_width = 0;
+                       image_height = 0;
+
+                       return;
+               }
+
                var window = get_window();
 
                double xscale = 1, yscale = 1;
@@ -54,7 +63,7 @@ class Gitg.DiffImageComposite : Gtk.DrawingArea
                int natural_height;
 
                get_natural_size(out natural_width, out natural_height);
-               minimum_width = 1;
+               minimum_width = 0;
        }
 
        protected override void get_preferred_height_for_width(int width, out int minimum_height, out int 
natural_height)


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