From f8f5b059edd06ec647e50dab107906ce8141d284 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 24 Jul 2022 01:22:40 -0500 Subject: [PATCH] [ox/std] Fix Result::moveTo to not move if error --- deps/ox/src/ox/std/error.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deps/ox/src/ox/std/error.hpp b/deps/ox/src/ox/std/error.hpp index 8635dc13..e1412ffe 100644 --- a/deps/ox/src/ox/std/error.hpp +++ b/deps/ox/src/ox/std/error.hpp @@ -174,7 +174,9 @@ struct [[nodiscard]] Result { } constexpr Error moveTo(type *val) noexcept { - *val = std::move(value); + if (!error) [[likely]] { + *val = std::move(value); + } return error; }