From feb156bdb5184e47a57cea2501a8d37bd23f438a Mon Sep 17 00:00:00 2001 From: ilor <ilor@vger.(none)> Date: Mon, 9 May 2011 13:52:16 +0200 Subject: [PATCH] avoid erroring when there are norules of some type in wccl-rules --- wccl-apps/wccl-rules.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wccl-apps/wccl-rules.cpp b/wccl-apps/wccl-rules.cpp index 4d43404..e7e18c9 100644 --- a/wccl-apps/wccl-rules.cpp +++ b/wccl-apps/wccl-rules.cpp @@ -92,10 +92,15 @@ std::pair<int,int> RuleRunner::load_more_rules(const std::string& filename) if (parsed_file) { boost::filesystem::path p(filename); file_names_.push_back(p.stem()); - size_t match_rules = parsed_file->get_match_rules().size(); - size_t tag_rules = parsed_file->get_tag_rules().size(); - total_match_rules_ += match_rules; + size_t match_rules = 0, tag_rules = 0; + if (parsed_file->has_tag_rules()) { + tag_rules = parsed_file->get_tag_rules().size(); + } + if (parsed_file->has_match_rules()) { + match_rules = parsed_file->get_match_rules().size(); + } total_tag_rules_ += tag_rules; + total_match_rules_ += match_rules; parsed_files_.push_back(parsed_file); return std::make_pair(tag_rules, match_rules); } else { -- GitLab