diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 8e8752b406..02deea24ac 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -483,7 +483,7 @@ ParameterGroup::~ParameterGroup() void ParameterGroup::contextMenuEvent ( QContextMenuEvent* event ) { QTreeWidgetItem* item = currentItem(); - if (item->isSelected()) + if (item && item->isSelected()) { expandAct->setEnabled(item->childCount() > 0); // do not allow to import parameters from a non-empty parameter group @@ -513,7 +513,7 @@ void ParameterGroup::keyPressEvent (QKeyEvent* event) void ParameterGroup::onDeleteSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (sel->isSelected() && sel->parent()) + if (sel && sel->isSelected() && sel->parent()) { if ( QMessageBox::question(this, tr("Remove group"), tr("Do you really want to remove this parameter group?"), QMessageBox::Yes, QMessageBox::No|QMessageBox::Default|QMessageBox::Escape) == @@ -537,7 +537,7 @@ void ParameterGroup::onDeleteSelectedItem() void ParameterGroup::onToggleSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (sel->isSelected()) + if (sel && sel->isSelected()) { if (sel->isExpanded()) sel->setExpanded(false); @@ -555,7 +555,7 @@ void ParameterGroup::onCreateSubgroup() if (ok && Gui::validateInput(this, name)) { QTreeWidgetItem* item = currentItem(); - if (item->isSelected()) + if (item && item->isSelected()) { ParameterGroupItem* para = static_cast(item); Base::Reference hGrp = para->_hcGrp; @@ -581,7 +581,7 @@ void ParameterGroup::onExportToFile() if ( !file.isEmpty() ) { QTreeWidgetItem* item = currentItem(); - if (item->isSelected()) + if (item && item->isSelected()) { ParameterGroupItem* para = static_cast(item); Base::Reference hGrp = para->_hcGrp; @@ -597,7 +597,7 @@ void ParameterGroup::onImportFromFile() if ( !file.isEmpty() ) { QTreeWidgetItem* item = currentItem(); - if (item->isSelected()) + if (item && item->isSelected()) { ParameterGroupItem* para = static_cast(item); Base::Reference hGrp = para->_hcGrp; @@ -631,7 +631,7 @@ void ParameterGroup::onImportFromFile() void ParameterGroup::onRenameSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (sel->isSelected()) + if (sel && sel->isSelected()) { editItem(sel, 0); } @@ -750,7 +750,7 @@ void ParameterValue::onChangeSelectedItem() void ParameterValue::onDeleteSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (sel->isSelected()) + if (sel && sel->isSelected()) { takeTopLevelItem(indexOfTopLevelItem(sel)); static_cast(sel)->removeFromGroup(); @@ -761,7 +761,7 @@ void ParameterValue::onDeleteSelectedItem() void ParameterValue::onRenameSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (sel->isSelected()) + if (sel && sel->isSelected()) { editItem(sel, 0); }