فهرست منبع

Kernel: Fix KResultOr move constructor not copying errors.

Sergey Bugaev 6 سال پیش
والد
کامیت
d211307547
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      Kernel/KResult.h

+ 5 - 1
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;
     }