nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: src/platforms: fallback to version field "0" on error when asking for a git_re...
[nit.git]
/
lib
/
core
/
text
/
flat.nit
diff --git
a/lib/core/text/flat.nit
b/lib/core/text/flat.nit
index
b7e8e61
..
2fa0bcb
100644
(file)
--- a/
lib/core/text/flat.nit
+++ b/
lib/core/text/flat.nit
@@
-666,15
+666,15
@@
private class ASCIIFlatString
end
redef fun substring(from, count) do
end
redef fun substring(from, count) do
+ var ln = _length
+ if count <= 0 then return ""
+ if (count + from) > ln then count = ln - from
if count <= 0 then return ""
if count <= 0 then return ""
-
if from < 0 then
count += from
if from < 0 then
count += from
- if count < 0 then return ""
+ if count <= 0 then return ""
from = 0
end
from = 0
end
- var ln = _length
- if (count + from) > ln then count = ln - from
return new ASCIIFlatString.full_data(_items, count, from + _first_byte, count)
end
return new ASCIIFlatString.full_data(_items, count, from + _first_byte, count)
end