- _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
- CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
- SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
- if ( !CORBA::is_nil( mesh ) )
- return mesh->GetAutoColor();
+ _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entry( ind ).toLatin1().data() );
+ CORBA::Object_var obj = SMESH::SObjectToObject( sobj );
+
+ if ( !CORBA::is_nil( obj ) ) {
+ SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
+ if ( !CORBA::is_nil( mesh ) )
+ return mesh->GetAutoColor();
+ }