From 42225a5cd91c55d84a855c459a218977c60a26ef Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Mon, 11 Mar 2024 23:35:01 +0200 Subject: [PATCH] Refactor node creation logic --- storage/node.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/storage/node.cpp b/storage/node.cpp index d8acd422..169a339c 100644 --- a/storage/node.cpp +++ b/storage/node.cpp @@ -140,10 +140,9 @@ namespace vfs this->Parent->Children.push_back(this); }; - if (Parent) - CreateWithParent(Name, Parent); - else if (NoParent) + if (NoParent) { + Parent = nullptr; const char *Path = Name; Node *RootNode = fs->FileSystemRoot->Children[0]; @@ -211,6 +210,8 @@ namespace vfs delete[] SegmentName; } while (cwk_path_get_next_segment(&segment)); } + else if (Parent) + CreateWithParent(Name, Parent); else { this->Name = new char[strlen(Name) + 1];