retreat lretreat: Fix crash when getstarg() fails

Broken in commit 40ec33b.  Mitigating factor: can only happen when the
player gives an empty argument, e.g. retreat 0 "".

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-01-09 16:12:29 +01:00
parent beedf8dced
commit b72f727b9b

View file

@ -87,6 +87,8 @@ retreat(int type)
nunits = 0;
if (player->argp[2] != NULL) {
pq = getstarg(player->argp[2], "Retreat path? ", buf1);
if (!pq)
return RET_SYN;
for (i = 0; i < RET_LEN - 1 && pq[i]; i++) {
if (chkdir(pq[i], DIR_STOP, DIR_LAST) < 0) {
pr("'%c' is not a valid direction...\n", pq[i]);