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



commit 697a11acc32f735c247fcb56baccaa388932ab80
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 3b2e317..e10bfe0 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]