diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-06-13 19:38:29 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-06-13 19:38:29 +0200 |
| commit | 7327f305efb1c6678722308cc5f9645dd39f451e (patch) | |
| tree | 0e15f4ad6f275aa689f5d66641d3d9ad59d15472 /Kernel/NewKit | |
| parent | 349fe48baf941b2d1b571d3a5d0d796823bae312 (diff) | |
MHR-31: Lots of fixes and improvements regarding the kernel.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Kernel/NewKit')
| -rw-r--r-- | Kernel/NewKit/Array.hpp | 4 | ||||
| -rw-r--r-- | Kernel/NewKit/MutableArray.hpp | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Kernel/NewKit/Array.hpp b/Kernel/NewKit/Array.hpp index 1c89f365..dca5c13f 100644 --- a/Kernel/NewKit/Array.hpp +++ b/Kernel/NewKit/Array.hpp @@ -21,13 +21,13 @@ namespace NewOS Array& operator=(const Array&) = default; Array(const Array&) = default; - ErrorOr<T> operator[](Size At) + ErrorOr<T*> operator[](Size At) { if (At > N) return {}; kcout << "Returning element\r"; - return ErrorOr<T>(fArray[At]); + return ErrorOr<T*>(&fArray[At]); } Boolean Empty() const diff --git a/Kernel/NewKit/MutableArray.hpp b/Kernel/NewKit/MutableArray.hpp index f9c79301..a3ad4cb1 100644 --- a/Kernel/NewKit/MutableArray.hpp +++ b/Kernel/NewKit/MutableArray.hpp @@ -170,6 +170,13 @@ namespace NewOS Boolean Add(const T val) { auto* iterationNode = fFirstNode; + + if (!iterationNode) + { + fFirstNode = new MutableLinkedList<T>(); + iterationNode = fFirstNode; + } + MUST_PASS(iterationNode); while (iterationNode) |
