Commit 0dd5d4e5 authored by Theodore Dubois's avatar Theodore Dubois Committed by Commit Bot

DNR: Fix "Compile called before Add" error message

RE2 was printing an error whenever a ruleset with no regex rules was
initialized. It wasn't causing any problems, but it was bugging me. Fix
it by skipping the initialization of an empty RegexRulesMatcher, because
it wasn't actually doing anything anyway (other than print an error).

R=karandeepb@chromium.org

Bug: 974391
Change-Id: Ia381bca2b9d60ac2407fd9121657fccc4b05e81c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2026592
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736586}
parent c7c9689d
......@@ -194,6 +194,9 @@ RegexRulesMatcher::GetBeforeRequestActionIgnoringAncestors(
}
void RegexRulesMatcher::InitializeMatcher() {
if (regex_list_->Length() == 0)
return;
for (const auto* regex_rule : *regex_list_) {
const flat_rule::UrlRule* rule = regex_rule->url_rule();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment