Skip to content

Commit

Permalink
Fix Unreal crashing when deleting an actor with a JSBMovement component.
Browse files Browse the repository at this point in the history
Add null check to JSBSimMovementCompVisualizer.cpp
  • Loading branch information
fadak0828 committed Dec 30, 2024
1 parent 318c804 commit 30cfc80
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ FJSBSimMovementCompVisualizer::~FJSBSimMovementCompVisualizer()
void FJSBSimMovementCompVisualizer::DrawVisualization(const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI)
{
const UJSBSimMovementComponent* MovementComponent = Cast<UJSBSimMovementComponent>(Component);
if (!MovementComponent)
{
return;
}

AActor* Owner = Component->GetOwner();

// Make sure we are ready to visualize this component
Expand Down Expand Up @@ -101,6 +106,11 @@ void FJSBSimMovementCompVisualizer::DrawVisualization(const UActorComponent* Com
void FJSBSimMovementCompVisualizer::DrawVisualizationHUD(const UActorComponent* Component, const FViewport* Viewport, const FSceneView* View, FCanvas* Canvas)
{
const UJSBSimMovementComponent* MovementComponent = Cast<UJSBSimMovementComponent>(Component);
if (!MovementComponent)
{
return;
}

AActor* Owner = MovementComponent->GetOwner();

FVector2D PixelLocation;
Expand Down

0 comments on commit 30cfc80

Please sign in to comment.