summary refs log tree commit diff stats
path: root/src/nre.nim
diff options
context:
space:
mode:
authorFlaviu Tamas <tamasflaviu@gmail.com>2015-01-10 20:54:36 -0500
committerFlaviu Tamas <tamasflaviu@gmail.com>2015-01-10 20:54:36 -0500
commit6fe0de0639fe3163376acfb3dad75e2264a88363 (patch)
treed8b96098881d0c7275562da47e27b7b81b0a59e7 /src/nre.nim
parentfb51221aa890df5535103c4056c2b09c994addbb (diff)
downloadNim-6fe0de0639fe3163376acfb3dad75e2264a88363.tar.gz
Fix incorrect check
pcre_study can return nil and still succeed
The indicator of failure is a non-nil error message
Diffstat (limited to 'src/nre.nim')
-rw-r--r--src/nre.nim2
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()