[grilo-plugins] [lastfm-albumart] Solved problem with null nodeTab



commit 1403140f885634429d1d3923ac8a92f132e2407a
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue Jun 8 12:43:00 2010 +0200

    [lastfm-albumart] Solved problem with null nodeTab
    
    Reported by Xabier Rodriguez Calvar <xrcalvar igalia com>.

 src/lastfm-albumart/grl-lastfm-albumart.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/lastfm-albumart/grl-lastfm-albumart.c b/src/lastfm-albumart/grl-lastfm-albumart.c
index 11169d1..2a19bf4 100644
--- a/src/lastfm-albumart/grl-lastfm-albumart.c
+++ b/src/lastfm-albumart/grl-lastfm-albumart.c
@@ -137,7 +137,7 @@ xml_get_image (const gchar *xmldata)
   xmlDocPtr doc;
   xmlXPathContextPtr xpath_ctx;
   xmlXPathObjectPtr xpath_res;
-  gchar *image;
+  gchar *image = NULL;
 
   doc = xmlReadMemory (xmldata, xmlStrlen ((xmlChar*) xmldata), NULL, NULL,
                        XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
@@ -159,10 +159,12 @@ xml_get_image (const gchar *xmldata)
     return NULL;
   }
 
-  image =
-    (gchar *) xmlNodeListGetString (doc,
-                                    xpath_res->nodesetval->nodeTab[0]->xmlChildrenNode,
-                                    1);
+  if (xpath_res->nodesetval->nodeTab) {
+    image =
+      (gchar *) xmlNodeListGetString (doc,
+                                      xpath_res->nodesetval->nodeTab[0]->xmlChildrenNode,
+                                      1);
+  }
   xmlXPathFreeObject (xpath_res);
   xmlXPathFreeContext (xpath_ctx);
   xmlFreeDoc (doc);



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