print an error instead of asserting.

This commit is contained in:
Enno Rehling 2018-05-06 19:27:22 +02:00
parent cfe21e7e1d
commit 68de367a98

View file

@ -2624,14 +2624,17 @@ static castorder *cast_cmd(unit * u, order * ord)
/* Weitere Argumente zusammenbasteln */ /* Weitere Argumente zusammenbasteln */
if (sp->parameter) { if (sp->parameter) {
char *params[MAX_PARAMETERS]; char *params[MAX_PARAMETERS];
int i, p = 0; int i, p;
for (;;) { for (p = 0; p != MAX_PARAMETERS; ++p) {
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
if (!s || *s == 0) { if (!s || *s == 0) {
break; break;
} }
assert(p + 1 < MAX_PARAMETERS); params[p] = str_strdup(s);
params[p++] = str_strdup(s); }
if (p == MAX_PARAMETERS) {
log_error("%s: MAX_PARAMETERS (%d) too small to CAST %s, parsing stopped early.",
unitname(u), MAX_PARAMETERS, sp->sname);
} }
args = args =
add_spellparameter(target_r, caster, sp->parameter, add_spellparameter(target_r, caster, sp->parameter,