From d2113075478d50481b5f7e1f04bca31b967a2044 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Thu, 13 Jun 2019 16:37:01 +0300 Subject: [PATCH] Kernel: Fix KResultOr move constructor not copying errors. --- Kernel/KResult.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Kernel/KResult.h b/Kernel/KResult.h index 4108b88947..b0c7a67f37 100644 --- a/Kernel/KResult.h +++ b/Kernel/KResult.h @@ -53,7 +53,11 @@ public: KResultOr(KResultOr&& other) { - new (&m_storage) T(move(other.value())); + m_is_error = other.m_is_error; + if (m_is_error) + m_error = other.m_error; + else + new (&m_storage) T(move(other.value())); other.m_is_error = true; other.m_error = KSuccess; }