Skip to content

Commit fdf46a1

Browse files
committed
fix
1 parent c332978 commit fdf46a1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

regex.v

+3-4
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ pub fn new_regex(source string, options int) !Regex {
5959
}
6060
extra := C.pcre_study(re, 0, voidptr(&pstudyerr))
6161
if extra == 0 {
62-
if pstudyerr == 0 {
63-
return error('no additional information')
62+
if pstudyerr != 0 {
63+
err := unsafe { cstring_to_vstring(pstudyerr) }
64+
return error('Failed to study regex: ${err}')
6465
}
65-
err := unsafe { cstring_to_vstring(pstudyerr) }
66-
return error('Failed to study regex: ${err}')
6766
}
6867
C.pcre_fullinfo(re, 0, C.PCRE_INFO_CAPTURECOUNT, &captures)
6968
return Regex{re, extra, captures, options}

0 commit comments

Comments
 (0)