From 48537fec814e556dcb12183c31061c4645d7b743 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 18 Sep 2019 12:01:05 +0200 Subject: [PATCH] fixes #12209 --- lib/pure/os.nim | 4 ++-- 1 file 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()