Skip to content

Commit

Permalink
Do not draw grid view if there are no cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Deseteral committed Sep 30, 2023
1 parent b45676f commit 802dbb9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gui/grid-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export abstract class GridView<T> {
* 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;
Expand Down

0 comments on commit 802dbb9

Please sign in to comment.