generated from freudenreichan/info2Praktikum-NeuronalesNetz
unittest fail gefixt ( Matrix fails out of range bei getMatrixAt )
This commit is contained in:
1 parent
4aee809756
commit
09ada4e4d0
1 file changed
+5
@@ -51,6 +51,11 @@ void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned
|
|||||||
|
|
||||||
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
{
|
{
|
||||||
|
if(matrix.buffer == NULL || rowIdx >= matrix.rows || colIdx >= matrix.cols)
|
||||||
|
{
|
||||||
|
return UNDEFINED_MATRIX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
return matrix.buffer[(rowIdx * matrix.cols) + colIdx];
|
return matrix.buffer[(rowIdx * matrix.cols) + colIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user