Skip to content

Commit

Permalink
Kernel: Fix KResultOr move constructor not copying errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
bugaevc authored and awesomekling committed Jun 14, 2019
1 parent 2720336 commit d211307
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Kernel/KResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ class alignas(T) KResultOr {

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;
}
Expand Down

0 comments on commit d211307

Please sign in to comment.