summaryrefslogtreecommitdiff
path: root/libdleyna/server/props.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdleyna/server/props.c')
-rw-r--r--libdleyna/server/props.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/libdleyna/server/props.c b/libdleyna/server/props.c
index f88c800..ad36174 100644
--- a/libdleyna/server/props.c
+++ b/libdleyna/server/props.c
@@ -1729,7 +1729,8 @@ on_exit:
GVariant *dls_props_get_object_prop(const gchar *prop, const gchar *root_path,
GUPnPDIDLLiteObject *object)
{
- const char *id;
+ const char *object_id;
+ const char *parent_id;
gchar *path;
const char *upnp_class;
const char *media_spec_type;
@@ -1740,14 +1741,21 @@ GVariant *dls_props_get_object_prop(const gchar *prop, const gchar *root_path,
guint uint_val;
if (!strcmp(prop, DLS_INTERFACE_PROP_PARENT)) {
- id = gupnp_didl_lite_object_get_parent_id(object);
- if (!id || !strcmp(id, "-1")) {
+ object_id = gupnp_didl_lite_object_get_id(object);
+ if (!object_id)
+ goto on_error;
+
+ parent_id = gupnp_didl_lite_object_get_parent_id(object);
+ if (!parent_id)
+ goto on_error;
+
+ if (!strcmp(object_id, "0") || !strcmp(parent_id, "-1")) {
DLEYNA_LOG_DEBUG("Prop %s = %s", prop, root_path);
retval = g_variant_ref_sink(g_variant_new_string(
root_path));
} else {
- path = dls_path_from_id(root_path, id);
+ path = dls_path_from_id(root_path, parent_id);
DLEYNA_LOG_DEBUG("Prop %s = %s", prop, path);
@@ -1756,11 +1764,11 @@ GVariant *dls_props_get_object_prop(const gchar *prop, const gchar *root_path,
g_free(path);
}
} else if (!strcmp(prop, DLS_INTERFACE_PROP_PATH)) {
- id = gupnp_didl_lite_object_get_id(object);
- if (!id)
+ object_id = gupnp_didl_lite_object_get_id(object);
+ if (!object_id)
goto on_error;
- path = dls_path_from_id(root_path, id);
+ path = dls_path_from_id(root_path, object_id);
DLEYNA_LOG_DEBUG("Prop %s = %s", prop, path);