Skip to content

Commit

Permalink
Changes throw to assert if programming error detected in MakeTouchingMap
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-langholtz committed Jan 1, 2024
1 parent 858ae6a commit bdb67ee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Library/source/playrho/d2/WorldContact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include <algorithm> // for std::count_if
#include <cassert> // for assert
#include <map>
#include <optional>
#include <utility> // for std::pair
Expand Down Expand Up @@ -201,12 +202,10 @@ auto MakeTouchingMap(const World &world)
if (!contact.IsTouching()) {
continue;
}
const auto emplaced =
[[maybe_unused]] const auto emplaced =
result.emplace(std::minmax(contact.GetContactableA(), contact.GetContactableB()),
ContactID(i));
if (!emplaced.second) {
throw InvalidArgument("malformed world: has duplicate contacts");
}
assert(emplaced.second);
}
return result;
}
Expand Down

0 comments on commit bdb67ee

Please sign in to comment.