Old code didn't check for natarg() failure, but relied on
sarg_type("-1") returning NS_UNDEF.
{
struct range range;
int list[NS_LSIZE];
- int n;
+ int cnum, n;
coord cx, cy;
int dist;
int flags;
- char natnumber[16];
char prompt[128];
char buf[1024];
return 0;
}
if (type == EF_NATION && isalpha(*str)) {
- sprintf(natnumber, "%d", natarg(str, NULL));
- str = natnumber;
+ cnum = natarg(str, NULL);
+ if (cnum < 0)
+ return 0;
+ sprintf(buf, "%d", cnum);
+ str = buf;
}
flags = ef_flags(type);
switch (sarg_type(str)) {