Skip to content

Commit

Permalink
Added check to avoid crash
Browse files Browse the repository at this point in the history
  • Loading branch information
moviebr committed Jan 30, 2023
1 parent 0026432 commit bafdbb7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,14 +872,16 @@ void Combat::doTargetCombat(Creature* caster, Creature* target, CombatDamage& da
if (success) {
if (damage.blockType == BLOCK_NONE || damage.blockType == BLOCK_ARMOR) {
for (const auto& condition : params.conditionList) {
if (caster == target || !target->isImmune(condition->getType())) {
if (caster == target || target && !target->isImmune(condition->getType())) {
Condition* conditionCopy = condition->clone();
if (caster) {
conditionCopy->setParam(CONDITION_PARAM_OWNER, caster->getID());
}

//TODO: infight condition until all aggressive conditions has ended
target->addCombatCondition(conditionCopy);
if (target) {
target->addCombatCondition(conditionCopy);
}
}
}
}
Expand Down

0 comments on commit bafdbb7

Please sign in to comment.