nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
31ed461
)
lib/fixed_ints: fix crash on `"-".is_int`
author
Alexis Laferrière
<alexis.laf@xymus.net>
Sun, 1 May 2016 21:33:53 +0000
(17:33 -0400)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Thu, 5 May 2016 17:25:41 +0000
(13:25 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/core/fixed_ints.nit
patch
|
blob
|
history
diff --git
a/lib/core/fixed_ints.nit
b/lib/core/fixed_ints.nit
index
c643eee
..
f2f3890
100644
(file)
--- 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)