From 8d6120c5a00adde1ae1c71f3346e5f45920bffa2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Sun, 1 May 2016 17:33:53 -0400 Subject: [PATCH] lib/fixed_ints: fix crash on `"-".is_int` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/core/fixed_ints.nit | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/fixed_ints.nit b/lib/core/fixed_ints.nit index c643eee..f2f3890 100644 --- a/lib/core/fixed_ints.nit +++ b/lib/core/fixed_ints.nit @@ -900,11 +900,13 @@ redef class Text # assert not "0xGE".is_int # assert not "".is_int # assert not "Not an Int".is_int + # assert not "-".is_int fun is_int: Bool do if bytelen == 0 then return false var s = remove_all('_') var pos = 0 - while s[pos] == '-' do + var len = s.length + while pos < len and s[pos] == '-' do pos += 1 end s = s.substring_from(pos) -- 1.7.9.5