Skip to content

Commit

Permalink
XML: workaround for bug in libxml2 2.9.9
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Feb 22, 2019
1 parent 202c7fd commit a55796b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/xml/reader.cr
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ struct XML::Reader

# Returns the XML for the node and its content including subtrees.
def read_outer_xml
# On a NONE type libxml2 2.9.9 is giving a segfault:
#
# https://gitlab.gnome.org/GNOME/libxml2/issues/43
#
# so we avoid the issue by returning early here.
#
# FIXME: if that issue is fixed we should revert this line
# to avoid doing an extra C call each time.
return "" if node_type.none?

xml = LibXML.xmlTextReaderReadOuterXml(@reader)
xml ? String.new(xml) : ""
end
Expand Down

0 comments on commit a55796b

Please sign in to comment.