[tracker/tracker-0.8] tracker-extract: Fix crash in albumart when pixbuf cannot be created



commit f2e7bff276554f885f4ec71311daa4b977f31de1
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jul 20 17:19:38 2010 +0200

    tracker-extract: Fix crash in albumart when pixbuf cannot be created

 src/tracker-extract/tracker-albumart-pixbuf.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-albumart-pixbuf.c b/src/tracker-extract/tracker-albumart-pixbuf.c
index b8b3bc9..aea1052 100644
--- a/src/tracker-extract/tracker-albumart-pixbuf.c
+++ b/src/tracker-extract/tracker-albumart-pixbuf.c
@@ -86,6 +86,14 @@ tracker_albumart_buffer_to_jpeg (const unsigned char *buffer,
 
 		pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
 
+		if (pixbuf == NULL) {
+			g_warning ("Could not get pixbuf from GdkPixbufLoader when setting album art");
+
+			gdk_pixbuf_loader_close (loader, NULL);
+
+			return FALSE;
+		}
+
 		if (!gdk_pixbuf_save (pixbuf, target, "jpeg", &error, NULL)) {
 			g_warning ("Could not save GdkPixbuf when setting album art, %s",
 			           error ? error->message : "no error given");



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