Added two asserts to ComponentGrid to check for invalid grid layouts.

This commit is contained in:
Leon Styhre 2021-11-13 15:33:42 +01:00
parent 4cf291798a
commit f8c10c539d

View file

@ -38,6 +38,8 @@ ComponentGrid::~ComponentGrid()
float ComponentGrid::getColWidth(int col) float ComponentGrid::getColWidth(int col)
{ {
assert(col >= 0 && col < mGridSize.x);
if (mColWidths[col] != 0) if (mColWidths[col] != 0)
return mColWidths[col] * mSize.x; return mColWidths[col] * mSize.x;
@ -55,6 +57,8 @@ float ComponentGrid::getColWidth(int col)
float ComponentGrid::getRowHeight(int row) float ComponentGrid::getRowHeight(int row)
{ {
assert(row >= 0 && row < mGridSize.y);
if (mRowHeights[row] != 0) if (mRowHeights[row] != 0)
return mRowHeights[row] * mSize.y; return mRowHeights[row] * mSize.y;