From: Lucas Bajolet Date: Fri, 19 Sep 2014 19:01:57 +0000 (-0400) Subject: lib/standard/string: Fix the case of null items in FlatBuffer when calling to_s X-Git-Tag: v0.6.9~28^2 X-Git-Url: http://nitlanguage.org lib/standard/string: Fix the case of null items in FlatBuffer when calling to_s Signed-off-by: Lucas Bajolet --- diff --git a/lib/standard/string.nit b/lib/standard/string.nit index 1319b26..c595162 100644 --- a/lib/standard/string.nit +++ b/lib/standard/string.nit @@ -657,6 +657,10 @@ end abstract class FlatText super Text + # Underlying C-String (`char*`) + # + # Warning : Might be void in some subclasses, be sure to check + # if set before using it. private var items: NativeString # Real items, used as cache for to_cstring is called @@ -1358,6 +1362,7 @@ class FlatBuffer redef fun to_s: String do written = true + if length == 0 then items = new NativeString(1) return new FlatString.with_infos(items, length, 0, length - 1) end