Don't derefence Matrix->SMPkluMatrix->KLUmatrixCommon if it is NULL.

Test for NULL moved upwards in front of dereferencing.
This commit is contained in:
Holger Vogt 2024-01-14 15:12:03 +01:00
parent f541c6fb05
commit 0141473aa4
1 changed files with 4 additions and 3 deletions

View File

@ -535,6 +535,10 @@ SMPcLUfac (SMPmatrix *Matrix, double PivTol)
if (ret == 0)
{
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
fprintf(stderr, "Error (ReFactor Complex): KLUcommon object is NULL. A problem occurred\n");
return 0 ;
}
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
if (ft_ngdebug) {
fprintf(stderr, "Warning (ReFactor Complex): KLU Matrix is SINGULAR\n");
@ -543,9 +547,6 @@ SMPcLUfac (SMPmatrix *Matrix, double PivTol)
}
return E_SINGULAR ;
}
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
fprintf (stderr, "Error (ReFactor Complex): KLUcommon object is NULL. A problem occurred\n") ;
}
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_EMPTY_MATRIX)
{
fprintf (stderr, "Error (ReFactor Complex): KLU Matrix is empty\n") ;