From 38caa46e5888c91a2cef57a7104c502d94cc6500 Mon Sep 17 00:00:00 2001 From: MARCEL HARA <MH261677@falmouth.ac.uk> Date: Thu, 27 Apr 2023 17:19:01 +0100 Subject: [PATCH] Updated Interaction.cpp to fix certain crashes --- Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index 7d152ac..a3ee695 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -25,8 +25,8 @@ void AInteraction::BeginPlay() Super::BeginPlay(); //Character & Camera refs - TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter()); - MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>()); + if (TempCharacterRef != nullptr) TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter()); + if (MainCamera != nullptr) MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>()); //Item refs TargetHealingLocation = HealingItem->GetActorLocation();