diff --git a/AK/Optional.h b/AK/Optional.h index f53176e0e7f..c9241e602f1 100644 --- a/AK/Optional.h +++ b/AK/Optional.h @@ -28,7 +28,7 @@ public: Optional(Optional&& other) : m_has_value(other.m_has_value) { - if (m_has_value) { + if (other.has_value()) { new (&m_storage) T(other.release_value()); other.m_has_value = false; } @@ -62,9 +62,8 @@ public: if (this != &other) { clear(); m_has_value = other.m_has_value; - if (m_has_value) { + if (other.has_value()) new (&m_storage) T(other.release_value()); - } } return *this; }