Fixed nullptr dereference in ItemUse
This commit is contained in:
parent
a8c80a3c66
commit
cd50b2c2e8
|
@ -368,7 +368,10 @@ void TurnHandler::ExecuteItemChoice(const ArbUt::BorrowedPtr<ItemTurnChoice>& ch
|
|||
return;
|
||||
}
|
||||
auto* script = battle.GetValue()->GetLibrary()->GetScriptResolver()->LoadItemScript(choice->GetItem());
|
||||
auto targetIndex = choice->GetTarget();
|
||||
if (script == nullptr) {
|
||||
return;
|
||||
}
|
||||
const auto& targetIndex = choice->GetTarget();
|
||||
ArbUt::OptionalBorrowedPtr<Creature> target = nullptr;
|
||||
if (targetIndex.has_value()) {
|
||||
target = battle.GetValue()->GetCreature(targetIndex.value());
|
||||
|
|
Loading…
Reference in New Issue