Unreal Editor crashes if I log InputComponent (Lec79 - Introducing Input Binding)

This is a really strange issue. The editor crashes if I have the block of code as below in which I check for the InputComponent:

if (InputComponent)
{
	//Input Compnent is found
	UE_LOG(LogTemp, Warning, TEXT("Input component found"))
}
else
{
	UE_LOG(LogTemp, Error, TEXT("%s missing input component"), *GetOwner()->GetName())
}

If I comment out this block of code then everything works fine. So I guess this is where the problem lies.

I have checked the Editor logs in the project folder (since the Editor crashes I cannot access the Output log there) and this is what I found there:

[2017.02.04-16.29.36:438][470]LogWindows:Error: === Critical error: ===
[2017.02.04-16.29.36:438][470]LogWindows:Error: 
[2017.02.04-16.29.36:438][470]LogWindows:Error: Fatal error: [File:D:\Build\++UE4+Release-4.13+Compile\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp] [Line: 83] 
[2017.02.04-16.29.36:439][470]LogWindows:Error: SECURE CRT: Invalid parameter detected.
[2017.02.04-16.29.36:439][470]LogWindows:Error: Expression: Unknown Function: Unknown. File: Unknown Line: 0
[2017.02.04-16.29.36:439][470]LogWindows:Error: 
[2017.02.04-16.29.36:439][470]LogWindows:Error: 
[2017.02.04-16.29.36:439][470]LogWindows:Error: 
[2017.02.04-16.29.36:439][470]LogWindows:Error: KERNELBASE.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Core.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Core.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Core.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor.exe
[2017.02.04-16.29.36:439][470]LogWindows:Error: ucrtbase.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: ucrtbase.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: ucrtbase.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: ucrtbase.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: ucrtbase.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Core.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-BuildingEscape-828.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Engine.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Engine.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Engine.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Engine.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Engine.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Engine.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-Engine.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-UnrealEd.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-UnrealEd.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-UnrealEd.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-UnrealEd.dll
[2017.02.04-16.29.36:439][470]LogWindows:Error: UE4Editor-UnrealEd.dll
[2017.02.04-16.29.36:440][470]LogWindows:Error: UE4Editor.exe
[2017.02.04-16.29.36:440][470]LogWindows:Error: UE4Editor.exe
[2017.02.04-16.29.36:440][470]LogWindows:Error: UE4Editor.exe
[2017.02.04-16.29.36:440][470]LogWindows:Error: UE4Editor.exe
[2017.02.04-16.29.36:440][470]LogWindows:Error: UE4Editor.exe
[2017.02.04-16.29.36:440][470]LogWindows:Error: KERNEL32.DLL
[2017.02.04-16.29.36:440][470]LogWindows:Error: ntdll.dll
[2017.02.04-16.29.36:440][470]LogWindows:Error: ntdll.dll
[2017.02.04-16.29.36:440][470]LogWindows:Error: 
[2017.02.04-16.29.36:459][470]LogExit: Executing StaticShutdownAfterError
[2017.02.04-16.29.36:462][470]LogWindows: FPlatformMisc::RequestExit(1)
[2017.02.04-16.29.36:462][470]Log file closed, 02/04/17 17:29:36

Can anyone point me in the right direction please?

Willing to bet it’s this line. Are you calling this code in the constructor? It won’t have an Owner until BeginPlay

Thank you for the response, Dan.

I am calling it in BeginPlay(), as done by Ben in his videos.

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

	UE_LOG(LogTemp, Warning, TEXT("Grabber reporting for duty"));
	// ...
	///Look for attached Physics Handle

	PhysicsHandle = GetOwner()->FindComponentByClass<UPhysicsHandleComponent>();
	if (PhysicsHandle)
	{
		//Physics handle is found
	}
	else
	{
		UE_LOG(LogTemp, Error, TEXT("%s missing physics handle component" ), *GetOwner()->GetName())
	}

	InputComponent = GetOwner()->FindComponentByClass<UInputComponent>();
	if (InputComponent)
	{
		//Input Compnent is found
		UE_LOG(LogTemp, Warning, TEXT("Input component found"))
	}
	else
	{
		UE_LOG(LogTemp, Error, TEXT("%s missing input component"), *GetOwner()->GetName())
	}

}

And commenting out everything from InputComponent = GetOwner()->FindComponentByClass<UInputComponent>(); makes it not crash? Seems strange. Did you try rebuilding your solution?

Yes, I did. Funnily enough, it just started working. I tried rebuilding (multiple times) and restarting my PC but to no avail. I am a bit flummoxed as to why it just started working (automatically after an hour or so) but I guess it is resolved for now.

Thanks anyway.

Privacy & Terms