From 5a08671fc0ee4e40d119f6f36cd2ed278c0d794f Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 15 Apr 2015 20:35:48 +0300 Subject: [PATCH] Prevent illegal positions for tmp_at It seems like m_throw() can call tmp_at() with !isok coordinates, so prevent those in both functions --- src/display.c | 1 + src/mthrowu.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/display.c b/src/display.c index 1369fbfb3..399bb1842 100644 --- a/src/display.c +++ b/src/display.c @@ -900,6 +900,7 @@ tmp_at(x, y) break; default: /* do it */ + if (!isok(x,y)) break; if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) { if (tglyph->style != DISP_ALL && !cansee(x,y)) break; if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) break; /* too many locations */ diff --git a/src/mthrowu.c b/src/mthrowu.c index e61814321..1ff6cddc3 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -440,7 +440,7 @@ struct obj *obj; /* missile (or stack providing it) */ tmp_at(bhitpos.x, bhitpos.y); delay_output(); } - tmp_at(bhitpos.x, bhitpos.y); + if (isok(bhitpos.x, bhitpos.y)) tmp_at(bhitpos.x, bhitpos.y); delay_output(); tmp_at(DISP_END, 0);