From 247d986b65461bb8aa710047f6c6e03b2fca400c Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 14 Jul 2015 16:10:54 +0300 Subject: [PATCH] Issue #384: Crash on second creation of group is fixed --- src/PartSet/PartSet_PartDataModel.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/PartSet/PartSet_PartDataModel.cpp b/src/PartSet/PartSet_PartDataModel.cpp index 98eed0060..fff14f9d4 100644 --- a/src/PartSet/PartSet_PartDataModel.cpp +++ b/src/PartSet/PartSet_PartDataModel.cpp @@ -140,12 +140,19 @@ QVariant PartSet_PartDataModel::data(const QModelIndex& theIndex, int theRole) c case ConstructObject: case GroupObject: case BodiesObject: { - std::string aGroup = theIndex.internalId() == ConstructObject ? - ModelAPI_ResultConstruction::group() : ModelAPI_ResultBody::group(); - ObjectPtr anObject = aPartDoc->object(aGroup, theIndex.row()); - if (anObject && anObject->data() && - anObject->data()->execState() == ModelAPI_StateMustBeUpdated) { - return QIcon(":pictures/constr_object_modified.png"); + std::string aGroup; + if (theIndex.internalId() == ConstructObject) + aGroup = ModelAPI_ResultConstruction::group(); + else if (theIndex.internalId() == BodiesObject) + aGroup = ModelAPI_ResultBody::group(); + else if (theIndex.internalId() == GroupObject) + aGroup = ModelAPI_ResultGroup::group(); + if (aGroup.length() > 0) { + ObjectPtr anObject = aPartDoc->object(aGroup, theIndex.row()); + if (anObject && anObject->data() && + anObject->data()->execState() == ModelAPI_StateMustBeUpdated) { + return QIcon(":pictures/constr_object_modified.png"); + } } return QIcon(":pictures/constr_object.png"); } -- 2.39.2