From bdb67eeebd81cd3fa6786868019ef5881ac528a7 Mon Sep 17 00:00:00 2001 From: Louis Langholtz Date: Sun, 31 Dec 2023 20:07:03 -0700 Subject: [PATCH] Changes throw to assert if programming error detected in MakeTouchingMap --- Library/source/playrho/d2/WorldContact.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Library/source/playrho/d2/WorldContact.cpp b/Library/source/playrho/d2/WorldContact.cpp index 893420c1b..eec8de95a 100644 --- a/Library/source/playrho/d2/WorldContact.cpp +++ b/Library/source/playrho/d2/WorldContact.cpp @@ -20,6 +20,7 @@ */ #include // for std::count_if +#include // for assert #include #include #include // for std::pair @@ -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; }