Commit 965e3256 authored by Haocheng LIU's avatar Haocheng LIU

Fix crash loading a .smtk file when native model is missing

When load a smtk file without the native model, ModelBuilder would
crash due to segfault.So an check is added that once the dateset is
not valid, we return failure.

Fix SMTK issue #92.
parent b9e1ea57
......@@ -228,6 +228,13 @@ smtk::model::OperatorResult ReadOperator::readExodus()
vtkMultiBlockDataSet* elemBlocks =
vtkMultiBlockDataSet::SafeDownCast(
modelOut->GetBlock(0));
if (!elemBlocks)
{
smtkErrorMacro(this->log(), "Error:Associated file " << filename << " is not valid!");
return this->createResult(OPERATION_FAILED);
}
MarkExodusMeshWithChildren(
elemBlocks, dim,
modelOut->GetMetaData(0u)->Get(vtkCompositeDataSet::NAME()),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment