From: Alexis Laferrière Date: Thu, 7 Sep 2017 15:48:34 +0000 (-0400) Subject: core: protect access to _items in empty strings X-Git-Url: http://nitlanguage.org core: protect access to _items in empty strings Signed-off-by: Alexis Laferrière --- diff --git a/lib/core/bytes.nit b/lib/core/bytes.nit index 882a6e9..41b6aa8 100644 --- a/lib/core/bytes.nit +++ b/lib/core/bytes.nit @@ -931,7 +931,7 @@ end redef class FlatText redef fun append_to_bytes(b) do var from = if self isa FlatString then first_byte else 0 - b.append_ns_from(items, byte_length, from) + if isset _items then b.append_ns_from(items, byte_length, from) end end diff --git a/lib/core/text/flat.nit b/lib/core/text/flat.nit index 06cdcfe..b728e42 100644 --- a/lib/core/text/flat.nit +++ b/lib/core/text/flat.nit @@ -1205,7 +1205,7 @@ private class FlatBufferByteIterator var curr_pos: Int - init do target_items = target._items + init do if isset target._items then target_items = target._items redef fun index do return curr_pos