1
0
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:
Ivan Savenko
2024-01-20 16:41:10 +02:00
parent 31b04780c9
commit 24d25730ad
6 changed files with 19 additions and 17 deletions

View File

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