coverity scan CID 22551: dereference before null check

This commit is contained in:
Enno Rehling 2015-10-29 09:22:00 +01:00
parent 4da658584c
commit c7aa8c89b1
1 changed files with 5 additions and 3 deletions

View File

@ -138,9 +138,11 @@ curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int duration)
/* mit C_SHIP_NODRIFT haben wir kein Problem */
curse *c =
create_curse(mage, &sh->attribs, ct_flyingship, power, duration, 0.0, 0);
c->data.v = sh;
if (c && c->duration > 0) {
sh->flags |= SF_FLYING;
if (c) {
c->data.v = sh;
if (c->duration > 0) {
sh->flags |= SF_FLYING;
}
}
return c;
}