Author: post
Date: 2010-11-22 19:50:12 +0100 (Mon, 22 Nov 2010)
New Revision: 303

Modified:
   RawSpeed/CameraMetaData.cpp
Log:
Check XML context and reset error prior to loading metadata.

Modified: RawSpeed/CameraMetaData.cpp
===================================================================
--- RawSpeed/CameraMetaData.cpp 2010-11-22 18:41:14 UTC (rev 302)
+++ RawSpeed/CameraMetaData.cpp 2010-11-22 18:50:12 UTC (rev 303)
@@ -26,10 +26,15 @@
 
 CameraMetaData::CameraMetaData(char *docname) {
   ctxt = xmlNewParserCtxt();
+  if (ctxt == NULL) {
+    ThrowCME("CameraMetaData:Could not initialize context.");
+  }
+
+  xmlResetLastError();
   doc = xmlCtxtReadFile(ctxt, docname, NULL, XML_PARSE_DTDVALID);
 
   if (doc == NULL) {
-    ThrowCME("CameraMetaData: XML Document could not be parsed successfully. 
Error was: %s", ctxt->lastError.message);
+      ThrowCME("CameraMetaData: XML Document could not be parsed successfully. 
Error was: %s", ctxt->lastError.message);
   }
 
   if (ctxt->valid == 0) {


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to