Commit 402fbb2a authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by David Partyka
Browse files

Fixed segfault when reading a Temporal collection with missing <Time>.

Fixed issue reported on the mailing list at:
http://www.paraview.org/pipermail/paraview/2011-January/019931.html
parent d5ce16f1
......@@ -217,6 +217,18 @@ vtkDataObject* vtkXdmfHeavyData::ReadTemporalCollection(
valid_children.push_back(child);
}
}
// if no child matched this timestep, handle the case where the user didn't
// specify any <Time /> element for the temporal collection.
for (XdmfInt32 cc=0;
valid_children.size() == 0 &&
cc < xmfTemporalCollection->GetNumberOfChildren(); cc++)
{
XdmfGrid* child = xmfTemporalCollection->GetChild(cc);
if (child && child->GetTime()->GetTimeType() == XDMF_TIME_UNSET)
{
valid_children.push_back(child);
}
}
if (valid_children.size() == 0)
{
......
......@@ -361,6 +361,18 @@ XdmfGrid* vtkXdmfDomain::GetGrid(XdmfGrid* xmfGrid, double time)
return child;
}
}
// It's possible that user has not specified a <Time /> element at all. In
// that case, try to locate the first grid with no time value set.
for (XdmfInt32 cc=0; cc < xmfGrid->GetNumberOfChildren(); cc++)
{
XdmfGrid* child = xmfGrid->GetChild(cc);
if (child && child->GetTime()->GetTimeType() == XDMF_TIME_UNSET)
{
return child;
}
}
// not sure what to do if no sub-grid matches the requested time.
return NULL;
}
......
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