lib/text: `FlatString::substring` returns "" on count == 0 or less
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 15 Feb 2016 20:12:06 +0000 (15:12 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 15 Feb 2016 20:17:55 +0000 (15:17 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/core/text/flat.nit

index 9a70db8..47b8608 100644 (file)
@@ -370,7 +370,7 @@ class FlatString
 
        redef fun substring(from, count)
        do
-               assert count >= 0
+               if count <= 0 then return ""
 
                if from < 0 then
                        count += from