Commit 7d211045 authored by Joachim Pouderoux's avatar Joachim Pouderoux
Browse files

Fix crash on loading VTK legacy file with no timesteps.

Crash was due to recent changes.

Change-Id: I6b1ef8c0f4e52734d7424dc67008a816a88e840a
parent ca67a448
......@@ -74,21 +74,25 @@ void pqDataTimeStepBehavior::onReaderCreated(pqPipelineSource* reader)
{
vtkSMPropertyHelper helper(readerProxy, "TimestepValues");
unsigned int num_timesteps = helper.GetNumberOfElements();
std::vector<double> timesteps = helper.GetDoubleArray();
unsigned int newTimeStep =
(defaultTimeStep == vtkPVGeneralSettings::DEFAULT_TIME_STEP_FIRST) ? 0 :
(num_timesteps - 1);
scene->setAnimationTime(timesteps[newTimeStep]);
if (num_timesteps > 0)
{
std::vector<double> timesteps = helper.GetDoubleArray();
unsigned int newTimeStep =
(defaultTimeStep == vtkPVGeneralSettings::DEFAULT_TIME_STEP_FIRST) ? 0 :
(num_timesteps - 1);
scene->setAnimationTime(timesteps[newTimeStep]);
}
}
else if (readerProxy->GetProperty("TimeRange"))
{
vtkSMPropertyHelper helper(readerProxy, "TimeRange");
std::vector<double> timeRange = helper.GetDoubleArray();
double newTime =
(defaultTimeStep == vtkPVGeneralSettings::DEFAULT_TIME_STEP_FIRST) ?
timeRange[0] : timeRange[1];
scene->setAnimationTime(newTime);
if (timeRange.size() > 0)
{
double newTime =
(defaultTimeStep == vtkPVGeneralSettings::DEFAULT_TIME_STEP_FIRST) ?
timeRange[0] : timeRange[1];
scene->setAnimationTime(newTime);
}
}
}
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