[tracker] NB#187149 - Not able to get metadata of few of the resources.



commit 0a7b9e8d5d958faea5803ec0e0b93e122bdd6792
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 26 16:23:20 2010 +0200

    NB#187149 - Not able to get metadata of few of the resources.
    
    Do not take !cursor as no results, rather !tracker_sparql_cursor_next().
    Also, ensure error is cleared before possibly reusing it in the next
    iteration.

 src/tracker-utils/tracker-info.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/tracker-utils/tracker-info.c b/src/tracker-utils/tracker-info.c
index 7779e50..7892752 100644
--- a/src/tracker-utils/tracker-info.c
+++ b/src/tracker-utils/tracker-info.c
@@ -243,24 +243,25 @@ main (int argc, char **argv)
 			            _("Unable to retrieve URN for URI"),
 			            error->message);
 
-			g_error_free (error);
+			g_clear_error (&error);
 			continue;
 		}
 
-		if (!cursor) {
-			/* No URN matches, use uri as URN */
-			urn = g_strdup (uri);
-		} else {
-			if (!tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+		if (!cursor || !tracker_sparql_cursor_next (cursor, NULL, &error)) {
+			if (error) {
 				g_printerr ("  %s, %s\n",
 				            _("Unable to retrieve data for URI"),
-				            _("No error given"));
+					    error->message);
 
-				g_free (uri);
 				g_object_unref (cursor);
+				g_clear_error (&error);
+
 				continue;
 			}
 
+			/* No URN matches, use uri as URN */
+			urn = g_strdup (uri);
+		} else {
 			urn = g_strdup (tracker_sparql_cursor_get_string (cursor, 0, NULL));
 			g_print ("  '%s'\n", urn);
 
@@ -279,7 +280,7 @@ main (int argc, char **argv)
 			            _("Unable to retrieve data for URI"),
 			            error->message);
 
-			g_error_free (error);
+			g_clear_error (&error);
 			continue;
 		}
 



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