diff --git a/Startcode/matrix.c b/Startcode/matrix.c index 7908656..e7689c1 100644 --- a/Startcode/matrix.c +++ b/Startcode/matrix.c @@ -10,6 +10,13 @@ Matrix createMatrix(unsigned int rows, unsigned int cols) m.buffer = calloc(rows*cols, sizeof(MatrixType)); m.rows = rows; m.cols = cols; + + if( rows <= 0 || cols <= 0) + { + m.rows = 0; + m.cols = 0; + } + return m; } void clearMatrix(Matrix *matrix)