Salome HOME
Fix SIGSEGV in "Mesh Element Info" dialog box if invalid node/element id is printed
authorvsr <vsr@opencascade.com>
Thu, 16 Dec 2010 10:19:11 +0000 (10:19 +0000)
committervsr <vsr@opencascade.com>
Thu, 16 Dec 2010 10:19:11 +0000 (10:19 +0000)
src/SMESHGUI/SMESHGUI_MeshInfo.cxx

index a40e4676f70d1602eed8d709780d85d31be66166..15ab587262aeb966dfde22b62ca83d860f53a65b 100644 (file)
@@ -1454,9 +1454,15 @@ void SMESHGUI_MeshInfoDlg::idChanged()
     TColStd_MapOfInteger ID;
     QSet<long> ids;
     QStringList idTxt = myID->text().split( " ", QString::SkipEmptyParts );
-    foreach ( QString id, idTxt ) {
-      ID.Add( id.trimmed().toLong() );
-      ids << id.trimmed().toLong();
+    foreach ( QString tid, idTxt ) {
+      long id = tid.trimmed().toLong();
+      const SMDS_MeshElement* e = myMode->checkedId() == ElemMode ? 
+       myActor->GetObject()->GetMesh()->FindElement( id ) :
+       myActor->GetObject()->GetMesh()->FindNode( id );
+      if ( e ) {
+       ID.Add( id );
+       ids << id;
+      }
     }
     selector->AddOrRemoveIndex( IO, ID, false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )