From d1742d56852b7e0b93482dd8dad261a146ac13bc Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Mon, 8 Jun 2020 21:33:38 +0200 Subject: [PATCH] when model is not yet loaded, but the element editor should be opened, a segmentation fault occurs. Do not set current index when m_model is not yet loaded --- sources/ElementsCollection/elementscollectionwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/ElementsCollection/elementscollectionwidget.cpp b/sources/ElementsCollection/elementscollectionwidget.cpp index 05db3446f..f59c3a1bf 100644 --- a/sources/ElementsCollection/elementscollectionwidget.cpp +++ b/sources/ElementsCollection/elementscollectionwidget.cpp @@ -123,7 +123,8 @@ void ElementsCollectionWidget::setCurrentLocation(const ElementsLocation &locati if (!location.exist()) return; - m_tree_view->setCurrentIndex(m_model->indexFromLocation(location)); + if (m_model) + m_tree_view->setCurrentIndex(m_model->indexFromLocation(location)); } void ElementsCollectionWidget::leaveEvent(QEvent *event)