From c1b20036877fe43e86ca8803994a5477546bf289 Mon Sep 17 00:00:00 2001 From: Itamar Date: Fri, 4 Jun 2021 19:34:24 +0300 Subject: [PATCH] HackStudio: Use Node's name when inserting to the ClassView tree Previously, when traversing the ClassView tree to find the parent of a new node, we used the name of the node's declaration to find the path to the parent in the tree. However, some nodes in the tree do not have a matching declaration, which caused a VERIFY failure. To fix this, we now use the node's name when walking the tree. We can do this because the node's name should be identical to the name of its declaration. Closes #7702. --- Userland/DevTools/HackStudio/ClassViewWidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.cpp b/Userland/DevTools/HackStudio/ClassViewWidget.cpp index f9d6f06adfe..acf180e57c9 100644 --- a/Userland/DevTools/HackStudio/ClassViewWidget.cpp +++ b/Userland/DevTools/HackStudio/ClassViewWidget.cpp @@ -147,8 +147,7 @@ void ClassViewModel::add_declaration(const GUI::AutocompleteProvider::Declaratio auto& scope = scope_parts[i]; ClassViewNode* next { nullptr }; for (auto& child : parent->children) { - VERIFY(child.declaration); - if (child.declaration->name == scope) { + if (child.name == scope) { next = &child; break; }