[tracker/tracker-0.12: 125/202] tracker-extract-oasis: Ignore empty values and invalid dates



commit 47b00f2eef5bc3586e106039fd8006331b61729b
Author: JÃrg Billeter <j bitron ch>
Date:   Tue Sep 27 17:02:33 2011 +0200

    tracker-extract-oasis: Ignore empty values and invalid dates

 src/tracker-extract/tracker-extract-oasis.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-oasis.c b/src/tracker-extract/tracker-extract-oasis.c
index 2f654d0..e6ca8a5 100644
--- a/src/tracker-extract/tracker-extract-oasis.c
+++ b/src/tracker-extract/tracker-extract-oasis.c
@@ -300,6 +300,11 @@ xml_text_handler_metadata (GMarkupParseContext  *context,
 	data = user_data;
 	metadata = data->metadata;
 
+	if (text_len == 0) {
+		/* ignore empty values */
+		return;
+	}
+
 	switch (data->current) {
 	case ODT_TAG_TYPE_TITLE:
 		if (data->title_already_set) {
@@ -354,9 +359,11 @@ xml_text_handler_metadata (GMarkupParseContext  *context,
 
 	case ODT_TAG_TYPE_CREATED:
 		date = tracker_date_guess (text);
-		tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
-		tracker_sparql_builder_object_unvalidated (metadata, date);
-		g_free (date);
+		if (date) {
+			tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
+			tracker_sparql_builder_object_unvalidated (metadata, date);
+			g_free (date);
+		}
 		break;
 
 	case ODT_TAG_TYPE_GENERATOR:



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