DoorOpen causes Crash if no ActorThatOpens specified?

Just curious. As I was playing around with building out a few rooms, copy pasting assets etc., I noticed that if you removed a trigger volume from a doors DoorOpen component, that the game would crash when you started PIE.

The solution for me was to remove the DoorOpen component from the actor in the level. I was simply surprised that having no named actor would cause a crash rather than simply resulting in a door that doesn’t move.

That seems unstable to me. Is that normal? Anyone have more info on why that would cause a crash?

Because the code has PressurePlate->IsOverlappingActor(ActorThatOpens) which if PressurePlate is nullptr, would mean you are trying to dereference a null pointer which is undefined behavoir. So you always want to protect against it if there’s a possibility it could be nullptr by just doing a simple check.

int* simpleCheck = nullptr;
if(simpleCheck)
{
    //code
}

Cool. Thanks! I see we covered similar stuff just a few lectures later. :slight_smile:

Privacy & Terms