Skip to content

Commit 700540c

Browse files
Omega3395Alberto Giacalonesaurabh1002
authored
Check reference_id in description matches vector (#83)
* Check reference_id in descriptor matches vector * Spacing * Trailing whitespace * Constant iterator --------- Co-authored-by: Alberto Giacalone <[email protected]> Co-authored-by: Saurabh Gupta <[email protected]>
1 parent f04d8d3 commit 700540c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cpp/map_closures/MapClosures.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ void MapClosures::MatchAndAddToDatabase(const int id,
110110
}
111111

112112
ClosureCandidate MapClosures::ValidateClosure(const int reference_id, const int query_id) const {
113-
const Tree::MatchVector &matches = descriptor_matches_.at(reference_id);
113+
const auto it = descriptor_matches_.find(reference_id);
114+
if (it == descriptor_matches_.end()) {
115+
return ClosureCandidate();
116+
}
117+
118+
const Tree::MatchVector &matches = it->second;
114119
const size_t num_matches = matches.size();
115120

116121
ClosureCandidate closure;

0 commit comments

Comments
 (0)