From 6aed1127ddf72d3f450ae2be10b875c503839dcf Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 26 Sep 2008 11:23:35 +0000 Subject: [PATCH] Fix regression List.Empty --- src/MeasureGUI/MeasureGUI_AngleDlg.cxx | 14 ++++++++------ src/MeasureGUI/MeasureGUI_DistanceDlg.cxx | 12 +++++++----- src/MeasureGUI/MeasureGUI_PointDlg.cxx | 5 ++++- src/MeasureGUI/MeasureGUI_Skeleton.cxx | 13 +++++++++---- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx index 1ec8fd5c8..31f5a69e6 100644 --- a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx @@ -153,14 +153,16 @@ void MeasureGUI_AngleDlg::SelectionIntoArgument() SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); - if ( !testResult ) - aSelectedObject = GEOM::GEOM_Object::_nil(); + if (aSelList.Extent() > 0) { + Standard_Boolean testResult = Standard_False; + aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + if (!testResult) + aSelectedObject = GEOM::GEOM_Object::_nil(); + } - if ( myEditCurrentArgument == mySelEdit ) + if (myEditCurrentArgument == mySelEdit) myObj = aSelectedObject; else myObj2 = aSelectedObject; diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index 075c27596..f5423056d 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -140,12 +140,14 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument() SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); - if ( !testResult ) - aSelectedObject = GEOM::GEOM_Object::_nil(); + if (aSelList.Extent() > 0) { + Standard_Boolean testResult = Standard_False; + aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + if (!testResult) + aSelectedObject = GEOM::GEOM_Object::_nil(); + } if ( myEditCurrentArgument == mySelEdit ) myObj = aSelectedObject; diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.cxx b/src/MeasureGUI/MeasureGUI_PointDlg.cxx index 843a9922c..d668675f9 100644 --- a/src/MeasureGUI/MeasureGUI_PointDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PointDlg.cxx @@ -131,11 +131,14 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); + if (aSelList.Extent() < 1) + return; + Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if ( !testResult || aSelectedObject->_is_nil() ) + if (!testResult || aSelectedObject->_is_nil()) return; myObj = aSelectedObject; diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx index 2dd79a196..fd1c345e5 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.cxx +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -250,11 +250,16 @@ void MeasureGUI_Skeleton::SelectionIntoArgument() SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); - if (!testResult || aSelectedObject->_is_nil()) { + if (aSelList.Extent() > 0) { + Standard_Boolean testResult = Standard_False; + aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + if (!testResult) + aSelectedObject = GEOM::GEOM_Object::_nil(); + } + + if (aSelectedObject->_is_nil()) { mySelEdit->setText(""); processObject(); erasePreview(); -- 2.39.2