From 6f3ea9b85aebfb5dbf22375c6c449dc13cb64749 Mon Sep 17 00:00:00 2001 From: Philipp Dreher Date: Sat, 7 Nov 2015 18:52:30 +0100 Subject: [PATCH] co is now first checked for validity before it is used for var-initialisation --- src/spells/flyingship.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/spells/flyingship.c b/src/spells/flyingship.c index 7751451ed..80b5b1a1e 100644 --- a/src/spells/flyingship.c +++ b/src/spells/flyingship.c @@ -37,14 +37,21 @@ int sp_flying_ship(castorder * co) { ship *sh; unit *u; - region *r = co_get_region(co); - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; + region *r; + unit *mage; + int cast_level; + double power; + spellparameter *pa; message *m = NULL; int cno; + assert(co); + r = co_get_region(co); + mage = co->magician.u; + cast_level = co->level; + power = co->force; + pa = co->par; + /* wenn kein Ziel gefunden, Zauber abbrechen */ if (pa->param[0]->flag == TARGET_NOTFOUND) return 0;