From 68de367a98e97c2a2756f762c0c6c4abf0cfb231 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 6 May 2018 19:27:22 +0200 Subject: [PATCH] print an error instead of asserting. --- src/magic.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/magic.c b/src/magic.c index 892c78e68..e6bb36002 100644 --- a/src/magic.c +++ b/src/magic.c @@ -2624,14 +2624,17 @@ static castorder *cast_cmd(unit * u, order * ord) /* Weitere Argumente zusammenbasteln */ if (sp->parameter) { char *params[MAX_PARAMETERS]; - int i, p = 0; - for (;;) { + int i, p; + for (p = 0; p != MAX_PARAMETERS; ++p) { s = gettoken(token, sizeof(token)); if (!s || *s == 0) { 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 = add_spellparameter(target_r, caster, sp->parameter,