]> git.meshlink.io Git - catta/commitdiff
workaround DBUS limitation which caused an assert() to fail when passing string lists...
authorLennart Poettering <lennart@poettering.net>
Sun, 1 Jan 2006 14:16:50 +0000 (14:16 +0000)
committerLennart Poettering <lennart@poettering.net>
Sun, 1 Jan 2006 14:16:50 +0000 (14:16 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1049 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-daemon/dbus-util.c

index 76a6b73c5984f1d97f0973c40a9a3007b54a8b54..c9ef949515eed2044c96bb4213f192b70e30b9dd 100644 (file)
@@ -327,9 +327,9 @@ int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) {
     dbus_message_iter_recurse(&iter, &sub);
         
     for (;;) {
-        DBusMessageIter sub2;
         int at, n;
-        uint8_t *k;
+        const uint8_t *k;
+        DBusMessageIter sub2;
         
         if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
             break;
@@ -340,7 +340,14 @@ int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) {
             goto fail;
 
         dbus_message_iter_recurse(&sub, &sub2);
-        dbus_message_iter_get_fixed_array(&sub2, &k, &n);
+            
+        if (dbus_message_iter_get_array_len(&sub2) > 0) 
+            dbus_message_iter_get_fixed_array(&sub2, &k, &n);
+        else {
+            k = (const uint8_t*) "";
+            n = 0;
+        }
+            
         strlst = avahi_string_list_add_arbitrary(strlst, k, n);
         
         dbus_message_iter_next(&sub);