From 7c75728180b2b9497bfd9716bd3e6ea139f464ee Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Thu, 29 Feb 2024 21:48:27 +0100 Subject: [PATCH] better assert --- src/Matrix.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Matrix.cpp b/src/Matrix.cpp index 5f36544..c27919c 100644 --- a/src/Matrix.cpp +++ b/src/Matrix.cpp @@ -113,7 +113,8 @@ std::size_t Matrix::GetColumnCount() const { } Matrix Matrix::SubMatrix(std::size_t origine_ligne, std::size_t origine_colonne, std::size_t ligne, std::size_t colonne) const { - assert(m_Raws >= ligne && m_Columns >= colonne); + assert(m_Raws >= origine_ligne + ligne && m_Columns >= origine_colonne + colonne); + Matrix result {ligne, colonne}; for (std::size_t i = 0; i < ligne; i++) {