[nautilus] icon-info: do not scale pixbuf to width or height of 0



commit 34a48ba3bec1215a936638000b22de2c73c51fc7
Author: Ernestas Kulik <ernestask src gnome org>
Date:   Thu Oct 20 23:32:54 2016 +0300

    icon-info: do not scale pixbuf to width or height of 0
    
    If the file thumbnail is really narrow or short, the scaled width or
    height can be 0, in which case gdk_pixbuf_scale_simple() returns NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773291

 src/nautilus-icon-info.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-icon-info.c b/src/nautilus-icon-info.c
index 0a83c74..329fca5 100644
--- a/src/nautilus-icon-info.c
+++ b/src/nautilus-icon-info.c
@@ -600,8 +600,13 @@ nautilus_icon_info_get_pixbuf_at_size (NautilusIconInfo *icon,
     }
 
     scale = (double) forced_size / s;
+
+    /* Neither of these can be 0. */
+    w = MAX (w * scale, 1);
+    h = MAX (h * scale, 1);
+
     scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
-                                             w * scale, h * scale,
+                                             w, h,
                                              GDK_INTERP_BILINEAR);
     g_object_unref (pixbuf);
     return scaled_pixbuf;


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