diff --git a/src/maths/KLU/klusmp.c b/src/maths/KLU/klusmp.c index 174dee419..d22c36f94 100644 --- a/src/maths/KLU/klusmp.c +++ b/src/maths/KLU/klusmp.c @@ -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") ;