Fix incorrect check
pcre_study can return nil and still succeed The indicator of failure is a non-nil error message
This commit is contained in:
parent
fb51221aa8
commit
6fe0de0639
1 changed files with 1 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue