From 31710838d4a8b799deaa3152049a29488402e3c1 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 16 May 2017 10:37:34 +0200 Subject: [PATCH] issue #0003025: Unhandled unknown exception caught in GUIApplication::notify when opening file --- src/Gui/Tree.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 5ba9110957..53f463a444 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1238,7 +1238,8 @@ void DocumentItem::slotHighlightObject (const Gui::ViewProviderDocumentObject& o void DocumentItem::slotExpandObject (const Gui::ViewProviderDocumentObject& obj,const Gui::TreeItemMode& mode) { FOREACH_ITEM(item,obj) - if(!item->parent()->isExpanded()) continue; + if (!item->parent() || // has no parent (see #0003025) + !item->parent()->isExpanded()) continue; switch (mode) { case Gui::Expand: item->setExpanded(true); @@ -1521,7 +1522,9 @@ void DocumentObjectItem::testStatus() } else { // invisible QStyleOptionViewItem opt; - opt.initFrom(this->treeWidget()); + // it can happen that a tree item is not attached to the tree widget (#0003025) + if (this->treeWidget()) + opt.initFrom(this->treeWidget()); #if QT_VERSION >= 0x040200 this->setForeground(0, opt.palette.color(QPalette::Disabled,QPalette::Text)); #else