Skip to content
Snippets Groups Projects
Commit 3ae5c0df authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Fix out-of-range condition for submatch.

parent 3cb90c6a
Branches
No related merge requests found
......@@ -90,19 +90,19 @@ void MatchVector::append(const boost::shared_ptr<MatchData> &m)
}
const boost::shared_ptr<const Match> MatchVector::submatch(size_t idx) const {
if (idx + 1< matches_.size() || idx == 0) {
if ((idx < matches_.size() + 1) || (idx == 0)) {
return matches_[idx - 1];
} else {
throw Wccl::WcclError("Match vector index out of range");
throw Wccl::WcclError("Match vector index out of range.");
}
}
const boost::shared_ptr<Match>& MatchVector::submatch(size_t idx)
{
if (idx + 1 < matches_.size() || idx == 0) {
if ((idx < matches_.size() + 1) || (idx == 0)) {
return matches_[idx - 1];
} else {
throw Wccl::WcclError("Match vector index out of range");
throw Wccl::WcclError("Match vector index out of range.");
}
}
......
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