Editor Crashes on: GetOwner FindComponentByClass

Hi. The editor crashes if i dont uncomment
MovementComponent = GetOwner()->FindComponentByClass();

Searched around the web and can’t seem to find a decent explenation, is there another way to get ahold of the component? Ive been searching like mad. Casting and whatnot. Please help.

LoginId:0c80783e42e1953ff3c28296a09e39dd
EpicAccountId:8a5069e5f92f4d63b560466445f0a395

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000

UE4Editor_DrivingGame_0013!UGoKartMovementReplicator::UGoKartMovementReplicator() [E:\UnDevelop\VGame\DrivingGame\Source\DrivingGame\GoKartMovementReplicator.cpp:16]
UE4Editor_CoreUObject!UClass::CreateDefaultObject() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:3672]
UE4Editor_CoreUObject!FObjectInitializer::CreateDefaultSubobject() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:3752]
UE4Editor_CoreUObject!UObject::CreateDefaultSubobject() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:111]
UE4Editor_DrivingGame_0013!AGoKart::AGoKart() [E:\UnDevelop\VGame\DrivingGame\Source\DrivingGame\GoKart.cpp:18]
UE4Editor_CoreUObject!UClass::CreateDefaultObject() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:3672]
UE4Editor_CoreUObject!UObjectLoadAllCompiledInDefaultProperties() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectBase.cpp:861]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectBase.cpp:950]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(FName,bool)>::ExecuteIfSafe() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:859]
UE4Editor_Core!TBaseMulticastDelegate<void,FName,bool>::Broadcast() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:1013]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Core\Private\Modules\ModuleManager.cpp:500]
UE4Editor_Projects!FModuleDescriptor::LoadModulesForPhase() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Projects\Private\ModuleDescriptor.cpp:561]
UE4Editor_Projects!FProjectManager::LoadModulesForProject() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Projects\Private\ProjectManager.cpp:63]
UE4Editor!FEngineLoop::LoadStartupModules() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:3854]
UE4Editor!FEngineLoop::PreInitPostStartupScreen() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:3220]
UE4Editor!GuardedMain() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:127]
UE4Editor!GuardedMainWrapper() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!WinMain() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

Responding to my own problem, solved it with:

	auto Owner = GetOwner();
	if (!ensure(Owner != nullptr)) {return;}
	MovementComponent = Owner->FindComponentByClass<UGoKartMovementComponent>();

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms