Skip to content

Commit

Permalink
fix: getTile return type should include null (#3112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Autsider666 authored Jun 29, 2024
1 parent 6db28e1 commit 35ea81b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/engine/TileMap/TileMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ export class TileMap extends Entity {
* For example, if I want the tile in fifth column (x), and second row (y):
* `getTile(4, 1)` 0 based, so 0 is the first in row/column
*/
public getTile(x: number, y: number): Tile {
public getTile(x: number, y: number): Tile | null {
if (x < 0 || y < 0 || x >= this.columns || y >= this.rows) {
return null;
}
Expand Down

0 comments on commit 35ea81b

Please sign in to comment.