Skip to content

Commit 6e19dd5

Browse files
GordonSmithCopilot
andauthored
Update include/cmcpp/context.hpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1808c0f commit 6e19dd5

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

include/cmcpp/context.hpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,16 @@ namespace cmcpp
8080

8181
inline void trap_if(const LiftLowerContext &cx, bool condition, const char *message = nullptr) noexcept(false)
8282
{
83-
if (!condition)
83+
if (condition)
8484
{
85-
return;
86-
}
87-
88-
const char *msg = message == nullptr ? "Unknown trap" : message;
89-
if (cx.trap)
90-
{
91-
cx.trap(msg);
92-
return;
85+
const char *msg = message == nullptr ? "Unknown trap" : message;
86+
if (cx.trap)
87+
{
88+
cx.trap(msg);
89+
return;
90+
}
91+
throw std::runtime_error(msg);
9392
}
94-
throw std::runtime_error(msg);
9593
}
9694

9795
inline LiftLowerContext make_trap_context(const HostTrap &trap)

0 commit comments

Comments
 (0)