Skip to content
Snippets Groups Projects
Commit 9580b36b authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

BUG: avoid segfault : minimize an empty vector causes a crash

parent b7d826ff
No related branches found
No related tags found
No related merge requests found
......@@ -141,17 +141,21 @@ SarParametricMapFunction<TInputImage, TCoordRep>
}
}
if(this->GetCoeff()->GetNumberOfPoints()>0)
{
// Create the linear system
vnl_sparse_matrix_linear_system<double> linearSystem(a, b);
vnl_lsqr linearSystemSolver(linearSystem);
// And solve it
linearSystemSolver.minimize(bestParams);
if(this->GetCoeff()->GetNumberOfPoints()>1)
linearSystemSolver.minimize(bestParams);
for(unsigned int pointId = 0; pointId < nbCoef; ++pointId)
{
this->GetCoeff()->SetPointData(pointId,bestParams[pointId]);
}
}
m_IsInitialize = true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment