Access violation - code c0000005 (first/second chance not available)

Hey, i got an error with code of c0000005 (first/second chance not available). When I look at log reports i decided to its related with RenderCustomDepth error. Thats happening when I’m playing over 4,5 mins later.

I have a method on Event Tick which called CheckForInteractable. I’m invoking this method on my Event Tick and in this method i get a component with using raytracing and changing CustomDepth of StaticMeshComponent.

Crash Reporter Log → Ubuntu Pastebin

(FirstPersonCharacter.cpp) CheckForInteractable Method → Ubuntu Pastebin

(Pickup.cpp) → Ubuntu Pastebin

What you really need to do is attach a debugger and diagnose the issue. It will break on the exception and you’ll be able to see what’s gone wrong. Whilst logs are handy if it’s something obvious, looking at logs is no real replacement for debugging.

Based on what you’ve posted however, in case you don’t know, 0xc0000005 is STATUS_ACCESS_VIOLATION (defined in winnt.h); an error occurred because of an attempt to access memory outside the process’s memory address space. This indicates that a pointer (or reference in some cases) is invalid.

In your case, I would assume that the log is one line out, and the error is actually on line 3126 where UPrimitiveComponent accesses its member bRenderCustomDepth; which would indicate that the UPrimitiveComponent pointer is null or garbage. So I’d double check the PickupMesh pointer in both your APickup functions before dereferencing (->) the pointer.

void APickup::SetCustomRenderFalse()

But really this is an (informed) stab in the dark; like I say what you really need to do is attach a debugger (Visual Studio: Debug | Attach To Process → UE4Editor.exe). Then recreate the error, check the “this” pointer in the Watch Window and step up the Callstack. The issue should present itself.

Really nice answer. I would accept this if it was my question.

Thanks for helping out. Question feedback was very helpful.