From 4ef4d6e1782c9538b86c7176c1cf7009c83e88bd Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Fri, 22 Sep 2017 16:36:23 -0400 Subject: [PATCH] lib/dom: avoid crash on empty tags data access Signed-off-by: Alexandre Terrasa --- lib/dom/dom.nit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dom/dom.nit b/lib/dom/dom.nit index 5a1b8c0..0dfee06 100644 --- a/lib/dom/dom.nit +++ b/lib/dom/dom.nit @@ -58,13 +58,13 @@ redef class XMLStartTag # var xml = code.to_xml # assert xml["animal"].first["tiger"].first.as(XMLStartTag).data == "This is a white tiger!" # ~~~ - fun data: String + fun data: nullable String do for child in children do if child isa PCDATA then return child.content if child isa CDATA then return child.content end - abort + return null end end -- 1.7.9.5