summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/raptor_rdfxml.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/raptor_rdfxml.c b/src/raptor_rdfxml.c
index 496c838b..c43b83e1 100644
--- a/src/raptor_rdfxml.c
+++ b/src/raptor_rdfxml.c
@@ -3205,18 +3205,23 @@ raptor_record_ID(raptor_parser *rdf_parser, raptor_element *element,
#ifdef RAPTOR_XML_LIBXML
xmlParserCtxtPtr
raptor_get_libxml_context(raptor_parser *rdf_parser) {
- return ((raptor_xml_parser*)rdf_parser->context)->sax2->xc;
+ raptor_xml_parser* rdfxml=(raptor_xml_parser*)rdf_parser->context;
+ return rdfxml->sax2 ? rdfxml->sax2->xc : NULL;
}
void
raptor_set_libxml_document_locator(raptor_parser *rdf_parser,
xmlSAXLocatorPtr loc) {
- ((raptor_xml_parser*)rdf_parser->context)->sax2->loc=loc;
+ raptor_xml_parser* rdfxml=(raptor_xml_parser*)rdf_parser->context;
+
+ if(rdfxml->sax2)
+ rdfxml->sax2->loc=loc;
}
xmlSAXLocatorPtr
raptor_get_libxml_document_locator(raptor_parser *rdf_parser) {
- return ((raptor_xml_parser*)rdf_parser->context)->sax2->loc;
+ raptor_xml_parser* rdfxml=(raptor_xml_parser*)rdf_parser->context;
+ return rdfxml->sax2 ? rdfxml->sax2->loc : NULL;
}
#ifdef RAPTOR_LIBXML_MY_ENTITIES