summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2019-06-13 16:37:01 +0300
committerAndreas Kling <awesomekling@gmail.com>2019-06-14 06:24:02 +0200
commitd2113075478d50481b5f7e1f04bca31b967a2044 (patch)
tree5a6727db6bd1b2f2ca9abd1285b053c87ab49981 /Kernel
parent27203369b4ed89c3780d9cc1903c349e501ef886 (diff)
downloadserenity-d2113075478d50481b5f7e1f04bca31b967a2044.zip
Kernel: Fix KResultOr move constructor not copying errors.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/KResult.h6
1 files changed, 5 insertions, 1 deletions
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;
}