Fixes for use after free
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-05-15 10:08:15 +02:00
parent 39a163a1aa
commit 1639a132a9
5 changed files with 10 additions and 8 deletions

View File

@@ -83,7 +83,7 @@ void PkmnLib::Battling::Pokemon::AttemptCapture(PkmnLib::Library::Item* catchIte
Ensure(_battleData.Side.HasValue());
Ensure(!IsFainted());
Ensure(IsUsable());
Ensure(!GetBattleSide().GetValue()->IsSlotUnfillabe(this)) auto captureLibrary =
auto captureLibrary =
GetLibrary().ForceAs<const BattleLibrary>()->GetCaptureLibrary();
auto result = captureLibrary->TryCatch(this, catchItem, _battleData.Battle.GetValue()->GetRandom());
_battleData.Battle.GetValue()->TriggerEventListener<CaptureAttemptEvent>(this, result);