From ffccf6bc49403168cdc5dd25427cd2b491de0210 Mon Sep 17 00:00:00 2001 From: Charlie Savage Date: Sun, 12 Jun 2016 01:59:09 -0600 Subject: [PATCH] Don't mark nil objects. --- ext/libxml/ruby_xml_node.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/libxml/ruby_xml_node.c b/ext/libxml/ruby_xml_node.c index 9b496a06..e7ef97a0 100644 --- a/ext/libxml/ruby_xml_node.c +++ b/ext/libxml/ruby_xml_node.c @@ -85,10 +85,12 @@ static void rxml_node_free(xmlNodePtr xnode) return; doc = rxml_lookup_doc(xnode->doc); - rb_gc_mark(doc); + if (doc != Qnil) + rb_gc_mark(doc); parent = rxml_lookup_node(xnode->parent); - rb_gc_mark(parent); + if (parent != Qnil) + rb_gc_mark(parent); } VALUE rxml_node_wrap(xmlNodePtr xnode)