Unreal engine crashing

Hey,
When I add:
FString ObjName = GetOwner()->GetName();

To the UPositionReport() method the Unreal engine crashes when compiling with the following stack trace:

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

UE4Editor_CoreUObject!UObjectBaseUtility::GetName() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\public\uobject\uobjectbaseutility.h:355]
UE4Editor_BuildingEscape_8236!UPositionReport::UPositionReport() [c:\users\strautins\documents\udemy\unreal projects\section_03\buildingescape\source\buildingescape\positionreport.cpp:13]
UE4Editor_HotReload!FHotReloadClassReinstancer::ReconstructClassDefaultObject() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:214]
UE4Editor_HotReload!FHotReloadClassReinstancer::RecreateCDOAndSetupOldClassReinstancing() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:249]
UE4Editor_HotReload!FHotReloadClassReinstancer::FHotReloadClassReinstancer() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:322]
UE4Editor_HotReload!FHotReloadClassReinstancer::Create() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreloadclassreinstancer.h:120]
UE4Editor_HotReload!FHotReloadModule::ReinstanceClass() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:1275]
UE4Editor_HotReload!FHotReloadModule::ReinstanceClasses() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:1262]
UE4Editor_HotReload!TBaseRawMethodDelegateInstance<0,FHotReloadModule,void __cdecl(void)>::ExecuteIfSafe() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:648]
UE4Editor_CoreUObject!TBaseMulticastDelegate<void>::Broadcast() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:937]
UE4Editor_CoreUObject!UClassReplaceHotReloadClasses() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:746]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:899]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:1027]
UE4Editor_Core!TBaseMulticastDelegate<void>::Broadcast() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:937]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\modules\modulemanager.cpp:479]
UE4Editor_Core!FModuleManager::LoadModule() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\modules\modulemanager.cpp:338]
UE4Editor_HotReload!FHotReloadModule::DoHotReloadInternal() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:864]
UE4Editor_HotReload!FHotReloadModule::DoHotReloadFromIDE() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:1521]
UE4Editor_HotReload!FHotReloadModule::Tick() [d:\build\++ue4+release-4.16+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:1454]
UE4Editor_Core!FTicker::Tick() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\containers\ticker.cpp:82]
UE4Editor!FEngineLoop::Tick() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:3262]
UE4Editor!GuardedMain() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launch.cpp:166]
UE4Editor!GuardedMainWrapper() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
UE4Editor!WinMain() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
kernel32
ntdll

I’m on Windows 10, Unreal 4.16.2, Visual Studio Community 2017. It seems to be re-producable, If I restore the project and add this line then compile the crash occurs.

Looks like GetOwner() is returning nullptr.

Isn’t nullptr a run-time error? The engine would crash and I could not even open it later. Re-installed Unreal and the problem persisted, so went ahead and re-installed VS and now everything is fine, really hope I won’t run into a similar issue down the line as this was very weird.

Update, a few videos later, working on the door, when logging the rotation with:

AActor *Owner = GetOwner(); FString Rotation = Owner->GetActorRotation().ToString(); UE_LOG(LogTemp, Warning, TEXT("The door rotation is: %s"), *Rotation);

Unreal crashes with the following stack trace:

Fatal error!

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000178

UE4Editor-BuildingEscape-5745.dll!UOpenDoor::UOpenDoor() [c:\users\strautins\documents\udemy\unreal projects\section_03\buildingescape\source\buildingescape\opendoor.cpp:14]
UE4Editor-CoreUObject.dll!UClass::CreateDefaultObject() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\class.cpp:2687]
UE4Editor-CoreUObject.dll!UObjectLoadAllCompiledInDefaultProperties() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:816]
UE4Editor-CoreUObject.dll!ProcessNewlyLoadedUObjects() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:894]
UE4Editor-CoreUObject.dll!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:1027]
UE4Editor-Core.dll!TBaseMulticastDelegate::Broadcast() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:937]
UE4Editor-Core.dll!FModuleManager::LoadModuleWithFailureReason() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\modules\modulemanager.cpp:479]
UE4Editor-Projects.dll!FModuleDescriptor::LoadModulesForPhase() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\projects\private\moduledescriptor.cpp:421]
UE4Editor-Projects.dll!FProjectManager::LoadModulesForProject() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\projects\private\projectmanager.cpp:60]
UE4Editor.exe!FEngineLoop::LoadStartupModules() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2470]
UE4Editor.exe!FEngineLoop::PreInit() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:1896]
UE4Editor.exe!GuardedMain() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launch.cpp:127]
UE4Editor.exe!GuardedMainWrapper() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
UE4Editor.exe!WinMain() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
UE4Editor.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
KERNEL32.DLL!0x0000000067092774
ntdll.dll!0x0000000067B20D51
ntdll.dll!0x0000000067B20D51

I cannot open the project anymore, it crashes with what seems a very similar stack trace:

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

UE4Editor_BuildingEscape_5745!UOpenDoor::UOpenDoor() [c:\users\strautins\documents\udemy\unreal projects\section_03\buildingescape\source\buildingescape\opendoor.cpp:14]
UE4Editor_CoreUObject!UClass::CreateDefaultObject() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\class.cpp:2687]
UE4Editor_CoreUObject!UObjectLoadAllCompiledInDefaultProperties() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:816]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:894]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:1027]
UE4Editor_Core!TBaseMulticastDelegate::Broadcast() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:937]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\modules\modulemanager.cpp:479]
UE4Editor_Projects!FModuleDescriptor::LoadModulesForPhase() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\projects\private\moduledescriptor.cpp:421]
UE4Editor_Projects!FProjectManager::LoadModulesForProject() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\projects\private\projectmanager.cpp:60]
UE4Editor!FEngineLoop::LoadStartupModules() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2470]
UE4Editor!FEngineLoop::PreInit() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:1896]
UE4Editor!GuardedMain() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launch.cpp:127]
UE4Editor!GuardedMainWrapper() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
UE4Editor!WinMain() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
kernel32
ntdll

I can compile the code in VS just fine. What I find interesting is that the file paths “d:/…” and “f:/…” don’t exist on my machine. F is a DVD drive, D is a secondary HDD where Unreal IS NOT installed on.
If I comment out said code and rebuild in VS the engine starts up normally.

Indeed, GetOwner is returning NULL, if I add a NULL check before doing something with the AActor there is no crash, but I do see a warning:

LogUObjectGlobals:Warning: Failed to find object 'Class /Script/BuildingEscape.BuildingEscapeGameMode'

It’s likely that the nullptr is in a constructor as these are run by the editor at load time. Indeed, the stack trace shows that your error is in UOpenDoor constructor.

I have the same issue, GetOwner() seems to be null. So how do i get the owner of the component then?

You need to check for null pointers. It might be that the constructor get’s called in certain cases in the engine just to display a blueprint. So it might not have an owner at that point.

Edit:

Sorry I had the code in an error in my code, have resolved!

I had the same error and it was caused by placing GetOwner() method in the constructor. When I moved it to PositionReporter::BegiPlay() method, it works fine:

void UPositionReporter::BeginPlay()
{
	Super::BeginPlay();

	// HERE IT WORKS FINE
	FString ObjectName = GetOwner()->GetName();
	UE_LOG(LogTemp, Warning, TEXT("Position report for %s"), *ObjectName);

	// ...
	
}

Hope it helps,
Robert

Hi, so I hit this error today. I got the level opening again by deleting the open door script and the binaries and rebuilding the level when I tried to open it. If you keep hitting these errors I hope this helps! Better to lose the door script than the whole project!

Privacy & Terms