Skip to content

Commit 0b0256e

Browse files
authored
Check for negative indices and skip shape drawing if index is negative
1 parent 389b77d commit 0b0256e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/accessibility/gridOutput.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ function _gridMap(idT, ingredients) {
6666
// Check if shape is in canvas, skip if not
6767
if(
6868
ingredients[x][y].loc.locY < cells.length &&
69-
ingredients[x][y].loc.locX < cells[ingredients[x][y].loc.locY].length
69+
ingredients[x][y].loc.locY >= 0 && ingredients[x][y].loc.locX >= 0
70+
ingredients[x][y].loc.locX < cells[ingredients[x][y].loc.locY].length
71+
7072
){
7173
//if empty cell of location of shape is undefined
7274
if (!cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX]) {

0 commit comments

Comments
 (0)