Skip to content

Commit

Permalink
fix a bug on false positive error report
Browse files Browse the repository at this point in the history
  • Loading branch information
CindyLinz committed May 23, 2017
1 parent 04b5fad commit 011d8fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R3.xs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ int r3_tree_compile_patterns(node * n, char **errstr) {
&pcre_error, /* for error message */
&pcre_erroffset, /* for error offset */
NULL); /* use default character tables */
if (n->pcre_pattern == NULL) {
if (n->pcre_pattern == NULL && pcre_error != NULL) {
if (errstr) {
asprintf(errstr, "PCRE compilation failed at offset %d: %s, pattern: %s", pcre_erroffset, pcre_error, n->combined_pattern);
}
Expand All @@ -1429,9 +1429,9 @@ int r3_tree_compile_patterns(node * n, char **errstr) {
pcre_free_study(n->pcre_extra);
}
n->pcre_extra = pcre_study(n->pcre_pattern, 0, &pcre_error);
if (n->pcre_extra == NULL) {
if (n->pcre_extra == NULL && pcre_error != NULL) {
if (errstr) {
asprintf(errstr, "PCRE study failed at offset %s, pattern: %s", pcre_error, n->combined_pattern);
asprintf(errstr, "PCRE study failed at offset %d: %s, pattern: %s", pcre_erroffset, pcre_error, n->combined_pattern);
}
return -1;
}
Expand Down

0 comments on commit 011d8fe

Please sign in to comment.