media-export: Prevent critical
authorJens Georg <jensg@openismus.com>
Wed, 10 Apr 2013 11:45:29 +0000 (13:45 +0200)
committerJens Georg <jensg@openismus.com>
Wed, 10 Apr 2013 11:47:55 +0000 (13:47 +0200)
With the previous change, if a file was added to the toplevel container, a
critical would occur since its parent is not a DummyContainer and thus the
cast resulted in NULL.

src/plugins/media-export/rygel-media-export-harvesting-task.vala

index d693f6d..8cbec76 100644 (file)
@@ -184,9 +184,9 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
             // Only add new containers. There's not much about a container so
             // we skip the updated signal
             var dummy_parent = parent as DummyContainer;
-            if (dummy_parent != null &&
-                dummy_parent.children.contains (MediaCache.get_id (file))) {
-                dummy_parent.add_child_tracked.begin (container);
+            if (dummy_parent == null ||
+                !dummy_parent.children.contains (MediaCache.get_id (file))) {
+                (parent as TrackableContainer).add_child_tracked.begin (container);
             }
 
             return true;