mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-28 21:58:28 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user