From 204b4d6b934a45c9e10362e77b5828ff08a25fab Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 30 Oct 2015 12:52:18 +0100 Subject: [PATCH] CID 22505: Dereference null return value (NULL_RETURNS) potential bugs at the edge of the map --- src/spells.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spells.c b/src/spells.c index d9f7f4b10..abb938780 100644 --- a/src/spells.c +++ b/src/spells.c @@ -5954,7 +5954,7 @@ int sp_movecastle(castorder * co) target_region = rconnect(r, dir); - if (!(target_region->terrain->flags & LAND_REGION)) { + if (!target_region || !(target_region->terrain->flags & LAND_REGION)) { ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "sp_movecastle_fail_1", "direction", dir)); return cast_level;