[tracker] tracker-extract-pdf: check if document returned before dereferencing it



commit cd7fdba252286178234a4b0102e3d0ad832bcd7f
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Jul 8 09:41:36 2010 +0200

    tracker-extract-pdf: check if document returned before dereferencing it

 src/tracker-extract/tracker-extract-pdf.cpp |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-pdf.cpp b/src/tracker-extract/tracker-extract-pdf.cpp
index 2d87baa..6bd6ba3 100644
--- a/src/tracker-extract/tracker-extract-pdf.cpp
+++ b/src/tracker-extract/tracker-extract-pdf.cpp
@@ -488,6 +488,13 @@ extract_pdf (const gchar          *uri,
 
 	document = poppler_document_new_pdf_from_file (uri, NULL);
 
+	if (!document) {
+		g_warning ("Could not create PopplerDocument from uri:'%s', "
+		           "NULL returned without an error",
+		           uri);
+		return;
+	}
+
 	if (!document->isOk()) {
 		int fopen_errno;
 		switch (document->getErrorCode()) {
@@ -517,13 +524,6 @@ extract_pdf (const gchar          *uri,
 		return;
 	}
 
-	if (!document) {
-		g_warning ("Could not create PopplerDocument from uri:'%s', "
-		           "NULL returned without an error",
-		           uri);
-		return;
-	}
-
 	tracker_sparql_builder_predicate (metadata, "a");
 	tracker_sparql_builder_object (metadata, "nfo:PaginatedTextDocument");
 



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