Skip to content
Snippets Groups Projects
Commit 9de243b2 authored by Römer's avatar Römer
Browse files

Check if actor is null before checking interfaces

parent 6edddcbc
No related branches found
No related tags found
3 merge requests!22Get changes and fixes from 4.26 into 5 as well,!11add HitActor Interaction bug fix into 4.27,!10Fixed Nullpointer Exception when Interacting with BrushActor
...@@ -63,7 +63,7 @@ void UBasicVRInteractionComponent::BeginInteraction() ...@@ -63,7 +63,7 @@ void UBasicVRInteractionComponent::BeginInteraction()
PressPointerKey(EKeys::LeftMouseButton); PressPointerKey(EKeys::LeftMouseButton);
if (HitActor->Implements<UGrabable>() && Hit->Distance < MaxGrabDistance) if (HitActor && HitActor->Implements<UGrabable>() && Hit->Distance < MaxGrabDistance)
{ {
// call grabable actors function so he reacts to our grab // call grabable actors function so he reacts to our grab
IGrabable::Execute_OnBeginGrab(HitActor); IGrabable::Execute_OnBeginGrab(HitActor);
...@@ -76,7 +76,7 @@ void UBasicVRInteractionComponent::BeginInteraction() ...@@ -76,7 +76,7 @@ void UBasicVRInteractionComponent::BeginInteraction()
// we save the grabbedActor in a general form to access all of AActors functions easily later // we save the grabbedActor in a general form to access all of AActors functions easily later
GrabbedActor = HitActor; GrabbedActor = HitActor;
} }
else if (HitActor->Implements<UClickable>() && Hit->Distance < MaxClickDistance) else if (HitActor && HitActor->Implements<UClickable>() && Hit->Distance < MaxClickDistance)
{ {
IClickable::Execute_OnClick(HitActor, Hit->Location); IClickable::Execute_OnClick(HitActor, Hit->Location);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment