summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-01-26 21:38:39 +0100
committerAraq <rumpf_a@web.de>2015-01-27 01:36:19 +0100
commit26b853923cbbd92b9b74cf1b9dce773b0ff39cf3 (patch)
tree6ccfe4b728b2469b69fe4a884f393b51dc22ab26 /lib
parent217390d18192e87534e61b9d15c55d44b7e163f7 (diff)
downloadNim-26b853923cbbd92b9b74cf1b9dce773b0ff39cf3.tar.gz
nimsuggest: first version
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/os.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 4981c6f12..147614d3d 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -599,7 +599,7 @@ proc splitPath*(path: string): tuple[head, tail: string] {.
 
 proc parentDirPos(path: string): int =
   var q = 1
-  if path[len(path)-1] in {DirSep, AltSep}: q = 2
+  if len(path) >= 1 and path[len(path)-1] in {DirSep, AltSep}: q = 2
   for i in countdown(len(path)-q, 0):
     if path[i] in {DirSep, AltSep}: return i
   result = -1