From 35e0027328718fbd0b94f0ca5ecdd8da2e727715 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 15 Apr 2015 19:43:32 +0300 Subject: [PATCH] Prevent out-of-bounds coords when closing a door --- src/lock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lock.c b/src/lock.c index c29be8549..26abde26a 100644 --- a/src/lock.c +++ b/src/lock.c @@ -692,6 +692,8 @@ doclose() /* try to close a door */ return(1); } + if (!isok(x,y)) goto nodoor; + if ((mtmp = m_at(x,y)) && mtmp->m_ap_type == M_AP_FURNITURE && (mtmp->mappearance == S_hcdoor || @@ -723,8 +725,10 @@ doclose() /* try to close a door */ pline_The("drawbridge is already closed."); else if (portcullis || door->typ == DRAWBRIDGE_DOWN) There("is no obvious way to close the drawbridge."); - else + else { +nodoor: You("%s no door there.", Blind ? "feel" : "see"); + } return res; }