From 6fe0de0639fe3163376acfb3dad75e2264a88363 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Sat, 10 Jan 2015 20:54:36 -0500 Subject: Fix incorrect check pcre_study can return nil and still succeed The indicator of failure is a non-nil error message --- src/nre.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nre.nim') 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() -- cgit 1.4.1-2-gfad0