diff options
author | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-10 20:54:36 -0500 |
---|---|---|
committer | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-10 20:54:36 -0500 |
commit | 6fe0de0639fe3163376acfb3dad75e2264a88363 (patch) | |
tree | d8b96098881d0c7275562da47e27b7b81b0a59e7 | |
parent | fb51221aa890df5535103c4056c2b09c994addbb (diff) | |
download | Nim-6fe0de0639fe3163376acfb3dad75e2264a88363.tar.gz |
Fix incorrect check
pcre_study can return nil and still succeed The indicator of failure is a non-nil error message
-rw-r--r-- | src/nre.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nre.nim b/src/nre.nim index 92cc7bbf4..29313e9eb 100644 --- a/src/nre.nim +++ b/src/nre.nim @@ -249,7 +249,7 @@ proc initRegex*(pattern: string, options = "Sx"): Regex = if opts.study: # XXX investigate JIT result.pcreExtra = pcre.study(result.pcreObj, 0x0, addr errorMsg) - if result.pcreExtra == nil: + if errorMsg != nil: raise StudyError(msg: $errorMsg) result.captureNameToId = result.getNameToNumberTable() |