diff options
author | Dave Beckett <dave@dajobe.org> | 2005-04-06 15:21:44 +0000 |
---|---|---|
committer | Dave Beckett <dave@dajobe.org> | 2005-04-06 15:21:44 +0000 |
commit | b2f627a1e64edbff26d0ef4cca5618db0d748da2 (patch) | |
tree | 85c40301dcddbb7bc5d6db330aac611792703f88 /src | |
parent | 774c0754c95c0542ec618266476b9e6310e37cc3 (diff) | |
download | raptor-b2f627a1e64edbff26d0ef4cca5618db0d748da2.tar.gz |
(raptor_get_libxml_context, raptor_set_libxml_document_locator,
raptor_get_libxml_document_locator): Survive NULL rdf_parser calls.
Diffstat (limited to 'src')
-rw-r--r-- | src/raptor_rdfxml.c | 11 |
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 |