summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/itdb_artwork.c7
-rw-r--r--src/ithumb-writer.c16
2 files changed, 15 insertions, 8 deletions
diff --git a/src/itdb_artwork.c b/src/itdb_artwork.c
index 4435a82..2defb4d 100644
--- a/src/itdb_artwork.c
+++ b/src/itdb_artwork.c
@@ -1,4 +1,4 @@
-/* Time-stamp: <2006-11-23 23:27:35 jcs>
+/* Time-stamp: <2006-11-26 23:31:45 jcs>
|
| Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
| Part of the gtkpod project.
@@ -662,12 +662,15 @@ itdb_thumb_get_gdk_pixbuf (Itdb_Device *device, Itdb_Thumb *thumb)
NULL);
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- g_object_ref (pixbuf);
+ if (pixbuf)
+ g_object_ref (pixbuf);
g_object_unref (loader);
}
if (!pixbuf)
+ {
return NULL;
+ }
/* !! cannot write directly to &thumb->width/height because
g_object_get() returns a gint, but thumb->width/height are
diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c
index f20546f..6de41b1 100644
--- a/src/ithumb-writer.c
+++ b/src/ithumb-writer.c
@@ -1,4 +1,4 @@
-/* Time-stamp: <2006-11-23 23:45:01 jcs>
+/* Time-stamp: <2006-11-26 23:30:08 jcs>
*
* Copyright (C) 2005 Christophe Fergeau
*
@@ -347,7 +347,8 @@ ithumb_writer_write_thumbnail (iThumbWriter *writer,
NULL);
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- g_object_ref (pixbuf);
+ if (pixbuf)
+ g_object_ref (pixbuf);
g_object_unref (loader);
g_free (thumb->image_data);
@@ -357,7 +358,11 @@ ithumb_writer_write_thumbnail (iThumbWriter *writer,
if (pixbuf == NULL)
{
- return FALSE;
+ /* This is quite bad... if we just return FALSE the ArtworkDB
+ gets messed up. For now let's insert a red thumbnail until
+ someone comes up with a "broken thumbnail" design */
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
+ gdk_pixbuf_fill (pixbuf, 0xff000000);
}
/* Rotate if necessary */
@@ -366,11 +371,10 @@ ithumb_writer_write_thumbnail (iThumbWriter *writer,
GdkPixbuf *new_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, thumb->rotation);
g_object_unref (pixbuf);
pixbuf = new_pixbuf;
+ /* Clean up */
+ thumb->rotation = 0;
}
- /* Clean up */
- thumb->rotation = 0;
-
/* !! cannot write directly to &thumb->width/height because
g_object_get() returns a gint, but thumb->width/height are
gint16 !! */