Fixed problem in parsing of xml file
authorvlad <vlad@vlanout.(none)>
Tue, 17 Aug 2010 18:05:11 +0000 (21:05 +0300)
committervlad <vlad@vlanout.(none)>
Tue, 17 Aug 2010 18:05:11 +0000 (21:05 +0300)
applet/debian/changelog
applet/src/livewp-exthemes.c

index 79b0d2e..f84bbe5 100644 (file)
@@ -1,3 +1,9 @@
+live-wallpaper (0.8.1) unstable; urgency=low
+
+  * Fixed problem in parsing of xml files 
+
+ -- Vlad Vasiliev <vlad@gas.by>  Mon, 16 Aug 2010 12:39:10 +0200
+
 live-wallpaper (0.8) unstable; urgency=low
 
   * Added possibilty to use external themes (see examples in package Xscreensaver)
index 0876279..badf78f 100644 (file)
 GHashTable  * 
 parse_theme(gchar *file){
     GHashTable  *hash;
-    xmlDoc *doc;
-    xmlNode *root, *first_child, *node;
+    xmlDoc *doc = NULL;
+    xmlNode *root = NULL, *first_child, *node;
     doc = xmlReadFile(file, NULL, 0);
+    if (!doc)
+        return NULL;
     root = xmlDocGetRootElement(doc);
+    if (!root)
+        return NULL;
     first_child = root->children;
     hash = g_hash_table_new(g_str_hash, g_str_equal);
     for (node = first_child; node; node = node->next){
@@ -64,6 +68,7 @@ get_list_exthemes(void){
     Dirent  *dp;
     DIR     *dir_fd;
     GSList *store = NULL;
+    GHashTable *hash = NULL;
     
     dir_fd = opendir(EXTHEME_PATH);
     if(dir_fd){
@@ -74,7 +79,9 @@ get_list_exthemes(void){
                 continue;
             /* TO DO read only *.xml files */
             if(dp->d_type == DT_REG || dp->d_type == DT_LNK){
-                store = g_slist_append(store, parse_theme(g_strdup_printf("%s%s", EXTHEME_PATH, dp->d_name)));
+                hash = parse_theme(g_strdup_printf("%s%s", EXTHEME_PATH, dp->d_name));
+                if (hash)
+                    store = g_slist_append(store, hash);
             }
         }
         closedir(dir_fd);