(map): Fix crash on empty argument introduced in rev. 1.18.
This commit is contained in:
parent
083003ad82
commit
eff3f89cc6
1 changed files with 11 additions and 2 deletions
|
@ -52,9 +52,11 @@ map(void)
|
||||||
char *b;
|
char *b;
|
||||||
int unit_type = 0;
|
int unit_type = 0;
|
||||||
int bmap = 0;
|
int bmap = 0;
|
||||||
|
char *str;
|
||||||
struct nstr_sect ns;
|
struct nstr_sect ns;
|
||||||
char origin = '\0';
|
char origin = '\0';
|
||||||
int map_flags = 0;
|
int map_flags = 0;
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
if (**player->argp != 'm') {
|
if (**player->argp != 'm') {
|
||||||
if (**player->argp == 'b')
|
if (**player->argp == 'b')
|
||||||
|
@ -77,8 +79,15 @@ map(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!snxtsct(&ns, player->argp[1])) {
|
if (player->argp[1] == NULL) {
|
||||||
if (unit_map(unit_type, atoi(player->argp[1]), &ns, &origin))
|
str = getstring("(sects)? ", buf);
|
||||||
|
if (!str || !*str)
|
||||||
|
return RET_SYN;
|
||||||
|
} else
|
||||||
|
str = player->argp[1];
|
||||||
|
|
||||||
|
if (!snxtsct(&ns, str)) {
|
||||||
|
if (unit_map(unit_type, atoi(str), &ns, &origin))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
for (b = player->argp[2]; b && *b; b++) {
|
for (b = player->argp[2]; b && *b; b++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue