From af758e204dd4096b5f0180f0b6c98c27011a48d6 Mon Sep 17 00:00:00 2001 From: Sergey Yagovtsev Date: Mon, 13 Nov 2023 23:15:51 +0300 Subject: [PATCH] #186 Prevent infinite loop --- profiler_gui/tree_widget_item.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiler_gui/tree_widget_item.cpp b/profiler_gui/tree_widget_item.cpp index d78b980..27f539b 100644 --- a/profiler_gui/tree_widget_item.cpp +++ b/profiler_gui/tree_widget_item.cpp @@ -374,9 +374,9 @@ const profiler::BlocksTree& TreeWidgetItem::block() const profiler::thread_id_t TreeWidgetItem::threadId() const { const QTreeWidgetItem* parentItem = this; - while (parentItem->parent() != nullptr) + while (parentItem != nullptr && parentItem->parent() != nullptr) { - parentItem = parent(); + parentItem = parentItem->parent(); } return static_cast(parentItem->data(COL_NAME, Qt::UserRole).toULongLong()); }