Can't use 'foreach' on strv from dynamic dbus calls
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 11 May 2009 22:27:23 +0000 (01:27 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 11 May 2009 22:27:23 +0000 (01:27 +0300)
Sizes of arrays returned by dynamic dbus calls are uknown, hence we
can't iterate over them using 'foreach' loop.

src/plugins/external/rygel-external-item.vala

index 055270d..d57d34f 100644 (file)
@@ -70,8 +70,9 @@ public class Rygel.ExternalItem : MediaItem {
         props.Get (ITEM_IFACE, "urls", out value);
         weak string[] uris = (string[]) value.get_boxed ();
 
-        foreach (var uri in uris) {
-            var tmp = uri.replace ("://@HOSTNAME@", parent.host_ip);
+        for (var i = 0; uris[i] != null; i++) {
+            var tmp = uris[i].replace ("://@HOSTNAME@", parent.host_ip);
+
             this.uris.add (tmp);
         }
     }