diff options
author | Krzesimir Nowak <krnowak@openismus.com> | 2012-11-27 11:25:52 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2012-11-28 17:41:24 +0100 |
commit | 8e87795b5d70e50049bd020dd1439c916ec784ce (patch) | |
tree | 2de760eb52209cb6394bcd8538866dc923db64e1 | |
parent | 14337ba553f303e1df16910e39635b83a8ddf786 (diff) | |
download | gupnp-av-8e87795b5d70e50049bd020dd1439c916ec784ce.tar.gz |
Fix the case when there are more than one InstanceId elements.
https://bugzilla.gnome.org/show_bug.cgi?id=689141
-rw-r--r-- | libgupnp-av/gupnp-last-change-parser.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libgupnp-av/gupnp-last-change-parser.c b/libgupnp-av/gupnp-last-change-parser.c index 43aabe7..cddddd8 100644 --- a/libgupnp-av/gupnp-last-change-parser.c +++ b/libgupnp-av/gupnp-last-change-parser.c @@ -76,7 +76,6 @@ read_state_variable (const char *variable_name, const char *val_str; variable_node = xml_util_get_element (instance_node, - "InstanceID", variable_name, NULL); if (!variable_node) @@ -102,13 +101,17 @@ get_instance_node (xmlDoc *doc, { xmlNode *node; - for (node = doc->children; + if (doc->children == NULL) + return NULL; + + for (node = doc->children->children; node; node = node->next) { - guint id; + if (node->type != XML_ELEMENT_NODE) + continue; - id = xml_util_get_uint_attribute (node, "val", 0); - if (id == instance_id) + if (!xmlStrcmp (node->name, BAD_CAST ("InstanceID")) && + xml_util_get_uint_attribute (node, "val", 0) == instance_id) break; } |