[rygel] media-export: Avoid crash on startup



commit 545ccd6cabfbd8d2087af60b67a15c1b3216473f
Author: Jens Georg <mail jensge org>
Date:   Sun Feb 14 19:45:02 2016 +0100

    media-export: Avoid crash on startup
    
    There is a slight possibility that init() is not called on RootContainer
    before the first browse action starts. This will cause the ObjectFactory to
    return null as the Filesystem folder, causing a null pointer access.
    
    Signed-off-by: Jens Georg <mail jensge org>

 .../rygel-media-export-root-container.vala         |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala 
b/src/plugins/media-export/rygel-media-export-root-container.vala
index 9bfbd80..38b6980 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -350,6 +350,13 @@ public class Rygel.MediaExport.RootContainer : TrackableDbContainer {
         return true;
     }
 
+    public override int count_children () {
+        if (!this.initialized) {
+            return 0;
+        } else {
+            return base.count_children ();
+        }
+    }
 
     /**
      * Create a new root container.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]