summary refs log tree commit diff stats
path: root/nim/strutils.pas
diff options
context:
space:
mode:
Diffstat (limited to 'nim/strutils.pas')
-rwxr-xr-xnim/strutils.pas8
1 files changed, 5 insertions, 3 deletions
diff --git a/nim/strutils.pas b/nim/strutils.pas
index afd8b4766..96c07d365 100755
--- a/nim/strutils.pas
+++ b/nim/strutils.pas
@@ -162,9 +162,11 @@ begin
     while (last <= length(s)) and (s[last] in seps) do inc(last);
     first := last;
     while (last <= length(s)) and not (s[last] in seps) do inc(last);
-    len := length(result);
-    setLength(result, len+1);
-    result[len] := ncopy(s, first, last-1);
+    if first >= last-1 then begin
+      len := length(result);
+      setLength(result, len+1);
+      result[len] := ncopy(s, first, last-1);
+    end
   end
 end;