Fem: Fix crash in pipeline

This commit is contained in:
marioalexis
2026-03-08 11:24:52 -05:00
committed by Chris Hennes
parent aa5feb3df0
commit 88940fb375
2 changed files with 4 additions and 3 deletions
+3
View File
@@ -571,6 +571,9 @@ void FemPostPipeline::setTimeInfo(const std::string& frameType, const Base::Unit
fd_block->AddArray(timeInfo);
for (unsigned int i = 0; i < multiblock->GetNumberOfBlocks(); ++i) {
vtkDataObject* grid = multiblock->GetBlock(i);
if (!grid) {
continue;
}
auto fd_grid = grid->GetFieldData();
if (fd_grid) {
// add time info to each grid
@@ -80,10 +80,9 @@ std::vector<double> vtkFemFrameSourceAlgorithm::getFrameValues()
std::vector<double> tFrames(nblocks);
for (unsigned long i = 0; i < nblocks; i++) {
vtkDataObject* block = multiblock->GetBlock(i);
// check if the TimeValue field is available
if (!block->GetFieldData()->HasArray("TimeValue")) {
if (!block || !block->GetFieldData() || !block->GetFieldData()->HasArray("TimeValue")) {
// a frame with no valid value is a undefined state
return std::vector<double>();
}
@@ -94,7 +93,6 @@ std::vector<double> vtkFemFrameSourceAlgorithm::getFrameValues()
// a frame with no valid value is a undefined state
return std::vector<double>();
}
tFrames[i] = vtkFloatArray::SafeDownCast(TimeValue)->GetValue(0);
}