First error fixing in createMatrix()

This commit is contained in:
Lukas Weber 2025-11-20 16:44:35 +01:00
parent 94a69b0068
commit 04493332f7

View File

@ -10,7 +10,10 @@ Matrix createMatrix(unsigned int rows, unsigned int cols)
Matrix newMatrix;
newMatrix.rows = rows;
newMatrix.cols = cols;
newMatrix.buffer = calloc(rows*cols, sizeof(MatrixType));
if (rows == 0 || cols == 0)
newMatrix.buffer = NULL;
else
newMatrix.buffer = calloc(rows*cols, sizeof(MatrixType));
return newMatrix;
}