[rygel] core: Prevent critical if URI exists



commit d2d9484d35b027a6a3e5daee49307238d13fc9d9
Author: Jens Georg <mail jensge org>
Date:   Thu Oct 13 10:52:54 2011 +0200

    core: Prevent critical if URI exists
    
    If the where clause does not match, there is no hash-table returned,
    not an empty one.

 .../tracker/rygel-tracker-insertion-query.vala     |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-insertion-query.vala b/src/plugins/tracker/rygel-tracker-insertion-query.vala
index 228feb2..29f8e56 100644
--- a/src/plugins/tracker/rygel-tracker-insertion-query.vala
+++ b/src/plugins/tracker/rygel-tracker-insertion-query.vala
@@ -109,15 +109,14 @@ public class Rygel.Tracker.InsertionQuery : Query {
 
         var result = yield resources.sparql_update_blank (str);
 
-        this.id = result[0,0].lookup (TEMP_ID);
-
         // Item already existed
-        if (this.id == null) {
+        if (result[0,0] == null || result[0,0].lookup (TEMP_ID) == null)  {
             var ids = yield resources.sparql_query
                                         (this.get_resource_id_query ());
 
             this.id = ids[0,0];
         } else {
+            this.id = result[0,0].lookup (TEMP_ID);
             var file = File.new_for_uri (this.uri);
             if (file.is_native () &&
                 file.query_exists ()) {



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