Engine crash while compile and restart

That would most likely be due to the GetWorld() part of it. Whenever you use GetWorld(), it’s best to check to make sure that GetWorld() isn’t returning a null pointer first. This would explain why the editor is crashing when it opens, as it tries to call this function before the level is initialized, resulting in a null pointer being given, causing the assert.

Edit: To check, just surround your statement that is using GetWorld() with an if statement like so:

if(GetWorld())
{
   //Statement that uses GetWorld()
}