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; ship *sh;
unit *u; unit *u;
region *r = co_get_region(co); region *r;
unit *mage = co->magician.u; unit *mage;
int cast_level = co->level; int cast_level;
double power = co->force; double power;
spellparameter *pa = co->par; spellparameter *pa;
message *m = NULL; message *m = NULL;
int cno; 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 */ /* wenn kein Ziel gefunden, Zauber abbrechen */
if (pa->param[0]->flag == TARGET_NOTFOUND) if (pa->param[0]->flag == TARGET_NOTFOUND)
return 0; return 0;