From 802dbb91f2b2b66e5dc5d436d225a7fec157fdd8 Mon Sep 17 00:00:00 2001 From: Deseteral Date: Sat, 30 Sep 2023 16:55:14 +0200 Subject: [PATCH] Do not draw grid view if there are no cells --- src/gui/grid-view.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/grid-view.ts b/src/gui/grid-view.ts index 71a16c9..1286ccc 100644 --- a/src/gui/grid-view.ts +++ b/src/gui/grid-view.ts @@ -78,6 +78,8 @@ export abstract class GridView { * Draws entire gridview with its upper-left corner at specified position. */ public drawAt(position: Vector2, scr: Screen): void { + if (this.cells.length === 0) return; + for (let row = 0; row < this.cells.length; row += 1) { for (let column = 0; column < this.cells[row].length; column += 1) { const isSelected = this.selectedColumn === column && this.selectedRow === row;