mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Changed checks for null with checks for hasValue
This commit is contained in:
@@ -327,9 +327,9 @@ void ApplyGhNetPackVisitor::visitCastAdvSpell(CastAdvSpell & pack)
|
||||
{
|
||||
gh.throwIfWrongOwner(&pack, pack.hid);
|
||||
|
||||
const CSpell * s = pack.sid.toSpell();
|
||||
if(!s)
|
||||
if (!pack.sid.hasValue())
|
||||
gh.throwNotAllowedAction(&pack);
|
||||
|
||||
const CGHeroInstance * h = gh.getHero(pack.hid);
|
||||
if(!h)
|
||||
gh.throwNotAllowedAction(&pack);
|
||||
@@ -338,6 +338,7 @@ void ApplyGhNetPackVisitor::visitCastAdvSpell(CastAdvSpell & pack)
|
||||
p.caster = h;
|
||||
p.pos = pack.pos;
|
||||
|
||||
const CSpell * s = pack.sid.toSpell();
|
||||
result = s->adventureCast(gh.spellEnv, p);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user