Skip to content

Commit b05d22a

Browse files
committed
Workaround for xQuartz/Cocoa on MacOS hitting our global error handler.
Fixes #458
1 parent f9483fc commit b05d22a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* read_html() now allows huge elements by default (#455)
44

5+
* Workaround for xQuartz/Cocoa on MacOS hitting our global error handler.
6+
57
# xml2 1.3.8
68

79
* Replace new "non-api" call IS_S4_OBJECT with Rf_isS4

src/xml2_init.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ void handleStructuredError(void* userData, xmlError* error) {
2222
error->message[len-1] = '\0';
2323
}
2424

25+
//Workaround for https://github.com/r-lib/xml2/issues/458
26+
#ifdef __APPLE__
27+
xmlParserCtxt *ctxt = error->ctxt;
28+
static unsigned char icns[5] = { 'i', 'c', 'n', 's', '\0' };
29+
if(error->code == XML_ERR_DOCUMENT_EMPTY && ctxt->input && ctxt->input->base && xmlStrcmp(ctxt->input->base, icns) == 0){
30+
return;
31+
}
32+
#endif
33+
2534
if (error->level <= 2) {
2635
Rf_warning("%s [%i]", error->message, (int) error->code);
2736
} else {

0 commit comments

Comments
 (0)