0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-26 08:01:51 +08:00

#186 Prevent infinite loop

This commit is contained in:
Sergey Yagovtsev 2023-11-13 23:15:51 +03:00
parent 3104dd4ae7
commit af758e204d

View File

@ -374,9 +374,9 @@ const profiler::BlocksTree& TreeWidgetItem::block() const
profiler::thread_id_t TreeWidgetItem::threadId() const profiler::thread_id_t TreeWidgetItem::threadId() const
{ {
const QTreeWidgetItem* parentItem = this; const QTreeWidgetItem* parentItem = this;
while (parentItem->parent() != nullptr) while (parentItem != nullptr && parentItem->parent() != nullptr)
{ {
parentItem = parent(); parentItem = parentItem->parent();
} }
return static_cast<profiler::thread_id_t>(parentItem->data(COL_NAME, Qt::UserRole).toULongLong()); return static_cast<profiler::thread_id_t>(parentItem->data(COL_NAME, Qt::UserRole).toULongLong());
} }