diff --git a/ext/nokogiri/xslt_stylesheet.c b/ext/nokogiri/xslt_stylesheet.c index d0ad6eaaf10..9575fd8e123 100644 --- a/ext/nokogiri/xslt_stylesheet.c +++ b/ext/nokogiri/xslt_stylesheet.c @@ -165,7 +165,7 @@ static VALUE transform(int argc, VALUE* argv, VALUE self) errstr = rb_str_new(0, 0); xsltSetGenericErrorFunc((void *)errstr, xslt_generic_error_handler); - xmlSetGenericErrorFunc(NULL, (xmlGenericErrorFunc)&swallow_superfluous_xml_errors); + xmlSetGenericErrorFunc((void *)errstr, xslt_generic_error_handler); result = xsltApplyStylesheet(wrapper->ss, xml, params); free(params); @@ -180,7 +180,11 @@ static VALUE transform(int argc, VALUE* argv, VALUE self) rb_exc_raise(exception); } - return Nokogiri_wrap_xml_document((VALUE)0, result) ; + if (result) { + return Nokogiri_wrap_xml_document((VALUE)0, result) ; + } + + rb_raise(rb_eRuntimeError, "unknown error transforming document, please report as a bug"); } static void method_caller(xmlXPathParserContextPtr ctxt, int nargs)