prevent crash if Col==-1

This commit is contained in:
Holger Vogt 2020-05-13 22:06:05 +02:00
parent 8143fb67c2
commit 80ad645b49
1 changed files with 5 additions and 0 deletions

View File

@ -460,6 +460,11 @@ SMPfindElt(SMPmatrix *Matrix, int Row, int Col, int CreateIfMissing)
assert( IS_SPARSE( Matrix ) );
Row = Matrix->ExtToIntRowMap[Row];
Col = Matrix->ExtToIntColMap[Col];
if (Col == -1)
/* No element available */
return NULL;
Element = Matrix->FirstInCol[Col];
Element = spcFindElementInCol(Matrix, &Element, Row, Col, CreateIfMissing);
return Element;