Skip to content

Commit

Permalink
Extra checks for valid locations when applying a bullwhip; fixes C343…
Browse files Browse the repository at this point in the history
…-383.
  • Loading branch information
sgrunt committed Apr 19, 2012
1 parent 93fbd9b commit 7831df3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/apply.c
Expand Up @@ -2208,7 +2208,7 @@ struct obj *obj;
if (Stunned || (Confusion && !rn2(5))) confdir();
rx = u.ux + u.dx;
ry = u.uy + u.dy;
mtmp = m_at(rx, ry);
mtmp = (isok(rx, ry)) ? m_at(rx, ry) : (struct monst *)0;

/* fake some proficiency checks */
proficient = 0;
Expand Down Expand Up @@ -2290,6 +2290,13 @@ struct obj *obj;
*/
const char *wrapped_what = (char *)0;

if (!isok(rx, ry)) {
pline("%s",
Is_airlevel(&u.uz) ? "You snap your whip through thin air."
: msg_snap);
return 1;
}

if (mtmp) {
if (bigmonst(mtmp->data)) {
wrapped_what = strcpy(buf, mon_nam(mtmp));
Expand Down

0 comments on commit 7831df3

Please sign in to comment.