From 52f8aeddb4aed954f55819d33b4af5a33cfb2486 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek Date: Tue, 14 May 2024 04:15:24 +0100 Subject: [PATCH] Bugfix Invalid AI Controller --- EndlessVendetta/Source/EndlessVendetta/AI/AICharacter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/EndlessVendetta/Source/EndlessVendetta/AI/AICharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/AI/AICharacter.cpp index 4057def9..1a1e2b02 100644 --- a/EndlessVendetta/Source/EndlessVendetta/AI/AICharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/AI/AICharacter.cpp @@ -77,8 +77,11 @@ void AAICharacter::SetupStimuliSourceComponent() void AAICharacter::OnDeath() { AAI_EnemyController* AIController = Cast(GetController()); + if (!IsValid(AIController)) return; UBlackboardComponent* Blackboard = AIController->GetBlackboardComponent(); + if (!IsValid(Blackboard)) return; AEndlessVendettaCharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn()); + if (!IsValid(PlayerCharacter)) return; if (Blackboard->GetValueAsBool("SeenWithHostilities")) { PlayerCharacter->DecrementSeenHostileCount();