Download

AddOnScreenDebugMessage Crash, how is this an Access violation?

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

UE4Editor_Engine!UEngine::AddOnScreenDebugMessage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\engine\private\unrealengine.cpp:6712]
UE4Editor_Engine!UEngine::AddOnScreenDebugMessage() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\engine\private\unrealengine.cpp:6743]



6712            FScreenMessageString* Message = ScreenMessages.Find(Key);

The “key” I used for the AddOnScreenDebugMessage() is 993566.

I am aware of -1 as a key. Which would indeed avoid the ScreenMessages.Find(Key); line of code.
But my question isn’t “is there a way around this?”.
My question is “why does a valid int32 cause an access violation?”

Because the FScreenMessageString* pointer is null. It can’t find that message in the Map (or whatever data structure is used for the messages), so whatever is happening after that is probably operating on a nullptr.

That’s my gut feeling anyway.