co is now first checked for validity before it is used for var-initialisation

This commit is contained in:
Philipp Dreher 2015-11-07 18:52:30 +01:00
parent 43b2e30c46
commit 6f3ea9b85a

View file

@ -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;