summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-09-18 12:01:05 +0200
committerAraq <rumpf_a@web.de>2019-09-18 12:16:52 +0200
commit48537fec814e556dcb12183c31061c4645d7b743 (patch)
tree3b8f7ef56509cac14a548fe3502868d2b0210edb /lib/pure
parent638a4d9d9fdec0f0d22f86eae872422b97be0159 (diff)
downloadNim-48537fec814e556dcb12183c31061c4645d7b743.tar.gz
fixes #12209
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/os.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 65b98d7a1..e59c0962d 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -1740,8 +1740,8 @@ template walkCommon(pattern: string, filter) =
           # that the file extensions have the same length ...
           let ff = getFilename(f)
           let idx = ff.len - pattern.len + dotPos
-          if dotPos < 0 or idx >= ff.len or ff[idx] == '.' or
-              pattern[dotPos+1] == '*':
+          if dotPos < 0 or idx >= ff.len or (idx >= 0 and ff[idx] == '.') or
+              (dotPos >= 0 and dotPos+1 < pattern.len and pattern[dotPos+1] == '*'):
             yield splitFile(pattern).dir / extractFilename(ff)
         if findNextFile(res, f) == 0'i32:
           let errCode = getLastError()