fix bugs in parse-grid.sml update functions: exit loopX and loopY if coordinate is not in range of grid
This commit is contained in:
@@ -11,7 +11,7 @@ struct
|
|||||||
|
|
||||||
local
|
local
|
||||||
fun loopY (yAxis, x, ex, y, ey, colour) =
|
fun loopY (yAxis, x, ex, y, ey, colour) =
|
||||||
if y > ey then
|
if y > ey orelse y >= Vector.length yAxis then
|
||||||
yAxis
|
yAxis
|
||||||
else
|
else
|
||||||
let val yAxis = Vector.update (yAxis, y, colour)
|
let val yAxis = Vector.update (yAxis, y, colour)
|
||||||
@@ -19,7 +19,7 @@ struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
fun loopX (grid, x, ex, y, ey, colour) =
|
fun loopX (grid, x, ex, y, ey, colour) =
|
||||||
if x > ex then
|
if x > ex orelse x >= Vector.length grid then
|
||||||
grid
|
grid
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user