[rygel] core: move try-catch block where it belongs



commit b0cf109e924ce0cbba75fbe57f167b23218c824d
Author: Jens Georg <mail jensge org>
Date:   Wed Sep 30 13:50:11 2009 +0200

    core: move try-catch block where it belongs

 src/rygel/rygel-media-db.vala |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/rygel/rygel-media-db.vala b/src/rygel/rygel-media-db.vala
index 670c6c1..c42b4cc 100644
--- a/src/rygel/rygel-media-db.vala
+++ b/src/rygel/rygel-media-db.vala
@@ -883,7 +883,14 @@ public class Rygel.MediaDB : Object {
                                                       long max_count) {
         Statement statement;
         ArrayList<MediaObject> children = new ArrayList<MediaObject> ();
-        var parent = (MediaContainer) get_object (container_id);
+        MediaContainer parent = null;
+        try {
+            parent = (MediaContainer) get_object (container_id);
+        } catch (MediaDBError err) {
+            warning ("Could not get parent object: %s", err.message);
+            return children;
+        }
+
         var rc = db.prepare_v2 (GET_CHILDREN_STRING,
                                 -1,
                                 out statement,
@@ -896,16 +903,12 @@ public class Rygel.MediaDB : Object {
             }
             while ((rc = statement.step ()) == Sqlite.ROW) {
                 var child_id = statement.column_text (17);
-                try {
-                    children.add (get_object_from_statement (parent,
-                                                             child_id,
-                                                             statement));
-                    children[children.size - 1].parent = parent;
-                    children[children.size - 1].parent_ref = parent;
-                } catch (MediaDBError err) {
-                    warning ("Could not get parent object: %s", err.message);
-                }
-            }
+                children.add (get_object_from_statement (parent,
+                                                         child_id,
+                                                         statement));
+                children[children.size - 1].parent = parent;
+                children[children.size - 1].parent_ref = parent;
+           }
         }
 
         return children;



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