Skip to content

Commit

Permalink
[WIP] Fix index out of range error (#327)
Browse files Browse the repository at this point in the history
Thanks to:

#318 (comment)

- [ ] Verification required.
  • Loading branch information
ganler authored Jan 6, 2021
1 parent 663f486 commit ddfc45a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/paf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ namespace parser {
hr1.score += hr2.score;
hr1.score += conn.score;

human_refs.erase(human_refs.begin() + hr_ids[1]);
// @ Thanks to @korejan.
size_t delete_id = hr_ids[1];
human_refs.erase(human_refs.begin() + delete_id);
for (auto& hr_ref : human_refs)
if (hr_ref.id > delete_id)
--hr_ref.id;
} else {
hr1.parts[part_id2].id = conn.cid2;
hr1.n_parts += 1;
Expand Down Expand Up @@ -383,4 +388,4 @@ namespace parser {

} // namespace parser

} // namespace hyperpose
} // namespace hyperpose

0 comments on commit ddfc45a

Please sign in to comment.