[PATCH] [filesystem] Prevent critical when getting URI from a filename



Verifies that the filename is not NULL before getting the URI.
---
 src/filesystem/grl-filesystem.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/filesystem/grl-filesystem.c b/src/filesystem/grl-filesystem.c
index 0131955..b95c3c0 100644
--- a/src/filesystem/grl-filesystem.c
+++ b/src/filesystem/grl-filesystem.c
@@ -361,10 +361,12 @@ create_content (GrlMedia *content,
       const gchar *thumb =
         g_file_info_get_attribute_byte_string (info,
                                                G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
-      gchar *thumb_uri = g_filename_to_uri (thumb, NULL, NULL);
-      if (thumb_uri) {
-        grl_media_set_thumbnail (GRL_DATA (media), thumb_uri);
-        g_free (thumb_uri);
+      if (thumb) {
+	gchar *thumb_uri = g_filename_to_uri (thumb, NULL, NULL);
+	if (thumb_uri) {
+	  grl_media_set_thumbnail (GRL_DATA (media), thumb_uri);
+	  g_free (thumb_uri);
+	}
       }
     }
 
-- 
1.7.0.4



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