[tracker/tracker-1.2] libtracker-miner: Handle multiple nfo:belongsToContainer properties to 1 nie:url



commit f6ca44fd353e00948108903a68971980e3194d5b
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Oct 8 10:48:01 2014 +0100

    libtracker-miner: Handle multiple nfo:belongsToContainer properties to 1 nie:url
    
    Previously we've expected this to be a 1:1 relationship, but it's not always
    the case with data containers

 src/libtracker-miner/tracker-file-notifier.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 77b21f7..719bd71 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -542,7 +542,20 @@ sparql_contents_check_deleted (TrackerFileNotifier *notifier,
        priv = notifier->priv;
 
        while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
-               file = g_file_new_for_uri (tracker_sparql_cursor_get_string (cursor, 0, NULL));
+               const gchar *uri;
+
+               /* Sometimes URI can be NULL when nie:url and
+                * nfo:belongsToContainer does not have a strictly 1:1
+                * relationship, e.g. data containers where there is
+                * only one nie:url but many nfo:belongsToContainer
+                * cases.
+                */
+               uri = tracker_sparql_cursor_get_string (cursor, 0, NULL);
+               if (!uri) {
+                       continue;
+               }
+
+               file = g_file_new_for_uri (uri);
                iri = tracker_sparql_cursor_get_string (cursor, 1, NULL);
 
                if (!tracker_file_system_peek_file (priv->file_system, file)) {


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