[FEM] improve checks for datasets

- check if datasets exists before we access them
- speed up the check for the datatype by testing after the downcast
This commit is contained in:
Uwe
2023-02-15 00:34:56 +01:00
committed by wwmayer
parent 3b67713b24
commit 99a7262e60
4 changed files with 25 additions and 21 deletions

View File

@@ -155,10 +155,9 @@ void ViewProviderFemPostPipeline::transformField(char *FieldName, double FieldFa
Fem::FemPostPipeline *obj = static_cast<Fem::FemPostPipeline *>(getObject());
vtkSmartPointer<vtkDataObject> data = obj->Data.getValue();
if (!data || !data->IsA("vtkDataSet"))
return;
vtkDataSet *dset = vtkDataSet::SafeDownCast(data);
if (!dset)
return;
vtkDataArray *pdata = dset->GetPointData()->GetArray(FieldName);
if (!pdata)
return;