Browse Source

AK: Make ErrorOr::error() const and return a const reference

Lucas CHOLLET 3 năm trước cách đây
mục cha
commit
42518867d7
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      AK/Error.h

+ 1 - 1
AK/Error.h

@@ -139,7 +139,7 @@ public:
     ErrorOr& operator=(ErrorOr&& other) = default;
     ErrorOr& operator=(ErrorOr const& other) = default;
 
-    ErrorType& error() { return m_error.value(); }
+    ErrorType const& error() const { return m_error.value(); }
     bool is_error() const { return m_error.has_value(); }
     ErrorType release_error() { return m_error.release_value(); }
     void release_value() { }