better check array index before using it

(grafted from 89fd0c38812b024734eeacf9c23ed3714c8b0f93
)
This commit is contained in:
Gael Guennebaud 2017-03-15 15:18:03 +01:00
parent 07c2244440
commit e59e345720

View File

@ -1004,7 +1004,7 @@ static IndexType find_ordering /* return the number of garbage collections */
COLAMD_ASSERT (head [min_score] >= COLAMD_EMPTY) ;
/* get pivot column from head of minimum degree list */
while (head [min_score] == COLAMD_EMPTY && min_score < n_col)
while (min_score < n_col && head [min_score] == COLAMD_EMPTY)
{
min_score++ ;
}