[tracker: 8/8] SPARQL: Warn instead of crash on namespace without prefix



commit cea095d4cae274ae45fc32bb7649a94c2fea2942
Author: Jürg Billeter <j bitron ch>
Date:   Mon Jun 7 13:37:56 2010 +0200

    SPARQL: Warn instead of crash on namespace without prefix

 src/libtracker-data/tracker-sparql-query.vala |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 9efb479..4eba6d5 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -385,6 +385,10 @@ public class Tracker.Sparql.Query : Object {
 		prefix_map.insert ("fn", FN_NS);
 
 		foreach (Namespace ns in Ontologies.get_namespaces ()) {
+			if (ns.prefix == null) {
+				critical ("Namespace does not specify a prefix: %s", ns.uri);
+				continue;
+			}
 			prefix_map.insert (ns.prefix, ns.uri);
 		}
 
@@ -446,6 +450,10 @@ public class Tracker.Sparql.Query : Object {
 		prefix_map.insert ("fn", FN_NS);
 
 		foreach (Namespace ns in Ontologies.get_namespaces ()) {
+			if (ns.prefix == null) {
+				critical ("Namespace does not specify a prefix: %s", ns.uri);
+				continue;
+			}
 			prefix_map.insert (ns.prefix, ns.uri);
 		}
 



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