[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

@@ -634,6 +634,8 @@ bool ViewProviderFemPostObject::setupPipeline()
// add a field with an absolute value
vtkSmartPointer<vtkDataObject> SPdata = data;
vtkDataSet* dset = vtkDataSet::SafeDownCast(SPdata);
if (!dset)
return false;
std::string FieldName;
auto numFields = dset->GetPointData()->GetNumberOfArrays();
for (int i = 0; i < numFields; ++i) {