diff --git a/src/mkmaze.c b/src/mkmaze.c index e16d7fbd6..5acf97cc6 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -363,6 +363,16 @@ place_lregion( hy = ROWNO - 1; } + /* clamp the area to the map */ + if (lx < 1) + lx = 1; + if (hx > COLNO - 1) + hx = COLNO - 1; + if (ly < 0) + ly = 0; + if (hy > ROWNO - 1) + hy = ROWNO - 1; + /* first a probabilistic approach */ oneshot = (lx == hx && ly == hy);