summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2021-02-07 14:55:56 -0700
committerAndreas Kling <kling@serenityos.org>2021-02-07 23:02:57 +0100
commit27a395d9643a8d38eb9642170ed3d7877a351029 (patch)
tree6ebb4f30c0608a1c03088befc67fe62d5da2430a
parentb22740c08ec45a2126897b20e871e2c66960c9f8 (diff)
downloadserenity-27a395d9643a8d38eb9642170ed3d7877a351029.zip
Kernel: Fix KResultOr copy-move from itself case
If move-assigning from itself we shouldn't do anything.
-rw-r--r--Kernel/KResult.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/KResult.h b/Kernel/KResult.h
index 8c7da0e079..b6988f1364 100644
--- a/Kernel/KResult.h
+++ b/Kernel/KResult.h
@@ -111,6 +111,8 @@ public:
KResultOr& operator=(KResultOr&& other)
{
+ if (&other == this)
+ return *this;
if (!m_is_error && m_have_storage) {
value().~T();
m_have_storage = false;