UE 4.11.2 Editor crash when loading C++ project

While compiling some C++ code changes the editor just shut down on me. Now I can’t load the project because every time I try to open it the editor crashes. I have tried deleting the project \Save and \Intermediate folders with no success.

This is a project migrated from 4.10.4. Have worked on it/compiled code for several days before the crash today.

Mini-dump reports Exception code 0xC0000005, The thread tried to from or write to a virtual address for which it does not have the appropriate access.

Excerpt of log (entire log is attached):

[2016.05.03-07.14.18:953][  0]LogStreaming:Warning: Failed to  file '../../../Engine/Content/Editor/Slate/Common/Selection_16x.png' error.
[2016.05.03-07.14.18:953][  0]LogSlate: Could not find file for Slate resource: ../../../Engine/Content/Editor/Slate/Common/Selection_16x.png
[2016.05.03-07.14.18:953][  0]LogStreaming:Warning: Failed to  file '../../../Engine/Content/Editor/Slate/Common/Selection_16x.png' error.
[2016.05.03-07.14.18:953][  0]LogSlate: Could not find file for Slate resource: ../../../Engine/Content/Editor/Slate/Common/Selection_16x.png
[2016.05.03-07.14.18:953][  0]LogStreaming:Warning: Failed to  file '../../../Engine/Content/Editor/Slate/Common/Selection_16x.png' error.
[2016.05.03-07.14.18:953][  0]LogSlate: Could not find file for Slate resource: ../../../Engine/Content/Editor/Slate/Common/Selection_16x.png
[2016.05.03-07.14.19:373][  0]LogUdpMessaging: Initializing bridge on interface 0.0.0.0:0 to multicast group 230.0.0.1:6666.
[2016.05.03-07.14.19:628][  0]LogWindows:Error: === Critical error: ===
Fatal error!

[2016.05.03-07.14.19:659][  0]LogExit: Executing StaticShutdownAfterError
[2016.05.03-07.14.19:660][  0]LogWindows: FPlatformMisc::RequestExit(1)
[2016.05.03-07.14.19:660][  0]Log file closed, 05/03/16 09:14:19

I have found a way to reproduce this, works every time. Steps:

1 Create new C++ project using Flying template

2 Edit the Pawn associated source file in Visual Studio (2015), go to constructor and add following after line 17:

static FConstructorStatics ConstructorStatics; //Add code below after this row
float tSecs = GetWorld()->GetTimeSeconds(); //<--- Add this

3 Save in VS, switch to UE editor and press compile

4 Watch the editor crash. I can reproduce this 100% of the time.

5 Now try to open the project that just crashed – the editor will crash while loading.

To recover:

6 Remove the reference to GetWorld()->GetTimeSeconds(), recompile in VS.

7 Try to open the project in UE4 editor now and watch it load just fine.

Okay so I am new to the entire UE4 dev environment but surely the editor should not crash because of a erroneous line of code?

Hey astroblaster-

The cause of the crash is the GetWorld() call before the world actually exists. If you wrap that specific line inside an if(GetWorld()) call, you should be able to load the editor without the crash. This will ensure that it checks for the world before trying to access it.

Cheers

Hey ,

Thanks, yes I finally figured out that calling this method in the constructor was a big no no so initial problem solved.

But I think the main issue remains and should be filed as a bug. The editor should handle misplaced code gracefully instead of crashing, or at the very least generate a clear message in the error dialog about the reason for the crash.

Thanks for looking into this.