# Crash on Geometry Brush with FHitResult

**URL:** <https://forums.unrealengine.com/t/crash-on-geometry-brush-with-fhitresult/341099>\
**Category:** C++\
**Tags:** actor, linetrace, unreal-engine, brush, geometry-brush, question, CPP\
**Created:** [December 10, 2015, 10:11pm UTC](https://forums.unrealengine.com/t/crash-on-geometry-brush-with-fhitresult/341099 "2015-12-10T22:11:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kowbell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kowbell](https://forums.unrealengine.com/u/Kowbell)\
**Post date:** [December 10, 2015, 10:11pm UTC](https://forums.unrealengine.com/t/crash-on-geometry-brush-with-fhitresult/341099/1 "2015-12-10T22:11:23Z")

</div>

I’m trying to some simple LineTrace stuff so I can

1.) See if the character is looking at something (within a certain distance)

2.) See if that thing is a certain class (so that we can interact with it, pick it up, etc.)

I’m having a trouble with Step 2.  
If the object IS one of the classes I’m looking for, it registers properly and all that. If, however, I’m looking at a Geometry Brush object, UE4 crashes immediately.

The culprit line is as follows:

```
if (HitResult.Actor->IsA(ACBaseWeapon::StaticClass()))

```

This conditional crashes the game, as does the line `UE_LOG(LogTemp, Log, TEXT("Actor Name: %s"), *HitResult.Actor->GetName());`

I assume therefore that the issue is with HitResult.Actor and geometry brushes. What work around do I need to use?

Thanks!

---

<div class="post-metadata">

**Author:** ![Kowbell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kowbell](https://forums.unrealengine.com/u/Kowbell)\
**Post date:** [December 13, 2015, 1:25pm UTC](https://forums.unrealengine.com/t/crash-on-geometry-brush-with-fhitresult/341099/2 "2015-12-13T13:25:01Z")

</div>

Found the solution. Since geometry brushes have no “root actor”, and only mesh components, getting the actor from a LineTrace returns a Null. When you try to get the name of a Null and print it, things go downhill.

Instead, if you might be looking at geometry brushes in your level, you might want to check if what you’re looking at has an actor first:

```
		if (HitResult.GetComponent()->GetAttachmentRootActor() != NULL)
		{
			UE_LOG(LogTemp, Warning, TEXT("We have an actor that won't crash! Actor Name: %s"), *HitResult.GetActor()->GetName());
		}
```
