Browse Source

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

Test for NULL moved upwards in front of dereferencing.
pre-master-46
Holger Vogt 2 years ago
parent
commit
0141473aa4
  1. 7
      src/maths/KLU/klusmp.c

7
src/maths/KLU/klusmp.c

@ -535,6 +535,10 @@ SMPcLUfac (SMPmatrix *Matrix, double PivTol)
if (ret == 0) 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 (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
if (ft_ngdebug) { if (ft_ngdebug) {
fprintf(stderr, "Warning (ReFactor Complex): KLU Matrix is SINGULAR\n"); fprintf(stderr, "Warning (ReFactor Complex): KLU Matrix is SINGULAR\n");
@ -543,9 +547,6 @@ SMPcLUfac (SMPmatrix *Matrix, double PivTol)
} }
return E_SINGULAR ; 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) if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_EMPTY_MATRIX)
{ {
fprintf (stderr, "Error (ReFactor Complex): KLU Matrix is empty\n") ; fprintf (stderr, "Error (ReFactor Complex): KLU Matrix is empty\n") ;

Loading…
Cancel
Save