From: vlad Date: Tue, 17 Aug 2010 18:05:11 +0000 (+0300) Subject: Fixed problem in parsing of xml file X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=088c8957f706b2e8967f1ed4d30e35a437520ced;p=livewp Fixed problem in parsing of xml file --- diff --git a/applet/debian/changelog b/applet/debian/changelog index 79b0d2e..f84bbe5 100644 --- a/applet/debian/changelog +++ b/applet/debian/changelog @@ -1,3 +1,9 @@ +live-wallpaper (0.8.1) unstable; urgency=low + + * Fixed problem in parsing of xml files + + -- Vlad Vasiliev 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) diff --git a/applet/src/livewp-exthemes.c b/applet/src/livewp-exthemes.c index 0876279..badf78f 100644 --- a/applet/src/livewp-exthemes.c +++ b/applet/src/livewp-exthemes.c @@ -28,10 +28,14 @@ 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);