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()); }