[gnome-packagekit/gnome-2-28] Check if we got an invalid pixbuf to prevent a crash



commit 9951e0fb638c637964ea5c5cf3aacbaf64717fbd
Author: Richard Hughes <richard hughsie com>
Date:   Tue Mar 23 09:53:46 2010 +0000

    Check if we got an invalid pixbuf to prevent a crash
    
    This can happen with broken themes, and fixes rh#541212

 src/gpk-animated-icon.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/gpk-animated-icon.c b/src/gpk-animated-icon.c
index 909d915..e848332 100644
--- a/src/gpk-animated-icon.c
+++ b/src/gpk-animated-icon.c
@@ -128,6 +128,12 @@ gpk_animated_icon_set_filename_tile (GpkAnimatedIcon *icon, GtkIconSize size, co
 		h = gdk_pixbuf_get_height (pixbuf) / 4;
 	}
 
+	/* we failed to get a valid pixbuf */
+	if (w == 0 || h == 0) {
+		g_object_unref (pixbuf);
+		return FALSE;
+	}
+
 	cols = gdk_pixbuf_get_width (pixbuf) / w;
 	rows = gdk_pixbuf_get_height (pixbuf) / h;
 



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