From ed4c4aa3633f3587deb14c781405a48c7599d62b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 28 Apr 2013 03:13:40 +0200 Subject: [PATCH] Some crashes and other minor stuff. Just things that Eressea has changed in the past 2 months --- res/de/strings.xml | 1 + src/items/weapons.c | 5 +++-- src/kernel/reports.c | 2 +- src/util/translation.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/res/de/strings.xml b/res/de/strings.xml index 3b7b88f43..bb16c92fe 100644 --- a/res/de/strings.xml +++ b/res/de/strings.xml @@ -7290,6 +7290,7 @@ Es ist Spätherbst, und diese Woche ist die letzte vor dem Winter, in der Insekten rekrutieren können. + It is the last week before winter in which insects can still recruit. diff --git a/src/items/weapons.c b/src/items/weapons.c index 7b817510a..9eb3d8d72 100644 --- a/src/items/weapons.c +++ b/src/items/weapons.c @@ -72,9 +72,10 @@ attack_firesword(const troop * at, const struct weapon_type *wtype, do { dt = select_enemy(fi, 0, 1, SELECT_ADVANCE | SELECT_DISTANCE); - assert(dt.fighter); --force; - killed += terminate(dt, *at, AT_SPELL, damage, 1); + if (dt.fighter) { + killed += terminate(dt, *at, AT_SPELL, damage, 1); + } } while (force && killed < enemies); if (casualties) *casualties = killed; diff --git a/src/kernel/reports.c b/src/kernel/reports.c index 54cdbb011..78292451e 100644 --- a/src/kernel/reports.c +++ b/src/kernel/reports.c @@ -1788,7 +1788,7 @@ int reports(void) static variant var_copy_string(variant x) { - x.v = strdup((const char *)x.v); + x.v = x.v?strdup((const char *)x.v):0; return x; } diff --git a/src/util/translation.c b/src/util/translation.c index e3493f434..a96f0914f 100644 --- a/src/util/translation.c +++ b/src/util/translation.c @@ -283,7 +283,7 @@ static const char *parse_string(opstack ** stack, const char *in, if (ic == NULL) return NULL; c = (char *)opop_v(stack); - bytes = (int)strlcpy(oc, c, size); + bytes = (int)c?strlcpy(oc, c, size):0; if (bytes < (int)size) oc += bytes; else