From f8c10c539d413e3c5d9272052b9d666c597cf2ff Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 13 Nov 2021 15:33:42 +0100 Subject: [PATCH] Added two asserts to ComponentGrid to check for invalid grid layouts. --- es-core/src/components/ComponentGrid.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/es-core/src/components/ComponentGrid.cpp b/es-core/src/components/ComponentGrid.cpp index 1fd3c4c7e..998aaea5f 100644 --- a/es-core/src/components/ComponentGrid.cpp +++ b/es-core/src/components/ComponentGrid.cpp @@ -38,6 +38,8 @@ ComponentGrid::~ComponentGrid() float ComponentGrid::getColWidth(int col) { + assert(col >= 0 && col < mGridSize.x); + if (mColWidths[col] != 0) return mColWidths[col] * mSize.x; @@ -55,6 +57,8 @@ float ComponentGrid::getColWidth(int col) float ComponentGrid::getRowHeight(int row) { + assert(row >= 0 && row < mGridSize.y); + if (mRowHeights[row] != 0) return mRowHeights[row] * mSize.y;