Editor Crashes When Open TankPlayerController Blueprint

Hello,

After following this lecture, I can no longer open TankPlayerController Blueprint, and it crashes if I do.

I traced it, and I found that this happens as long as

auto TankAimingComponent = GetPawn()->FindComponentByClass();

exists in the “AimTowardsCrosshair” method in TankPlayerController.cpp.

I can open the blueprint after commenting this line out.

I have looked into it for 2 hours, and very confused right now.

This is my github:

This is the crash report I get:

MachineId:18783DBD1043AD509DA35181A1F737C3
EpicAccountId:986dc58a1b154f2e872c4b724d7cfce0

SEGV_MAPERR at 0x0

ATankController::Aim() Address = 0x1b8e111bb [/Users/Shared/UnrealEngine/4.13/Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h, line 2674] [in UE4Editor-BattleTank-1127.dylib]
APlayerController::TickActor(float, ELevelTick, FActorTickFunction&) Address = 0x10b148534 (filename not found) [in UE4Editor-Engine.dylib]
FActorTickFunction::ExecuteTick(float, ELevelTick, ENamedThreads::Type, TRefCountPtr const&) Address = 0x10a0142f5 (filename not found) [in UE4Editor-Engine.dylib]
FTickFunctionTask::DoTask(ENamedThreads::Type, TRefCountPtr const&) Address = 0x10b6e4b31 (filename not found) [in UE4Editor-Engine.dylib]
TGraphTask::ExecuteTask(TArray<FBaseGraphTask*, FDefaultAllocator>&, ENamedThreads::Type) Address = 0x10b6e4537 (filename not found) [in UE4Editor-Engine.dylib]
FNamedTaskThread::ProcessTasksNamedThread(int, bool) Address = 0x10734af91 (filename not found) [in UE4Editor-Core.dylib]
FNamedTaskThread::ProcessTasksUntilQuit(int) Address = 0x107346a35 (filename not found) [in UE4Editor-Core.dylib]
FTaskGraphImplementation::ProcessThreadUntilRequestReturn(ENamedThreads::Type) Address = 0x1073432d1 (filename not found) [in UE4Editor-Core.dylib]
FTaskGraphImplementation::WaitUntilTasksComplete(TArray<TRefCountPtr, TInlineAllocator<4u, FDefaultAllocator> > const&, ENamedThreads::Type) Address = 0x107343b37 (filename not found) [in UE4Editor-Core.dylib]
FTickTaskSequencer::ReleaseTickGroup(ETickingGroup, bool) Address = 0x10b6ddc43 (filename not found) [in UE4Editor-Engine.dylib]
FTickTaskManager::RunTickGroup(ETickingGroup, bool) Address = 0x10b6d5924 (filename not found) [in UE4Editor-Engine.dylib]
UWorld::RunTickGroup(ETickingGroup, bool) Address = 0x10abde057 (filename not found) [in UE4Editor-Engine.dylib]
UWorld::Tick(ELevelTick, float) Address = 0x10abe6854 (filename not found) [in UE4Editor-Engine.dylib]
FSCSEditorViewportClient::Tick(float) Address = 0x1150d4afb (filename not found) [in UE4Editor-Kismet.dylib]
UEditorEngine::Tick(float, bool) Address = 0x10fac4b9a (filename not found) [in UE4Editor-UnrealEd.dylib]
UUnrealEdEngine::Tick(float, bool) Address = 0x110785247 (filename not found) [in UE4Editor-UnrealEd.dylib]
FEngineLoop::Tick() Address = 0x10723aaf4 (filename not found) [in UE4Editor]
GuardedMain(wchar_t const*) Address = 0x107242c2f (filename not found) [in UE4Editor]
-[UE4AppDelegate runGameThread:] Address = 0x107255b4c (filename not found) [in UE4Editor]
-[FCocoaGameThread main] Address = 0x107473726 (filename not found) [in UE4Editor-Core.dylib]
Unknown() Address = 0x7fffd2673c6d (filename not found) [in Foundation]
_pthread_body Address = 0x7fffe63beaab (filename not found) [in libsystem_pthread.dylib]
_pthread_body Address = 0x7fffe63be9f7 (filename not found) [in libsystem_pthread.dylib]
thread_start Address = 0x7fffe63be1fd (filename not found) [in libsystem_pthread.dylib]

Although The blueprint cannot be opened, everything works fine including the aiming.

Add the following to the beginning of Aim()

if (!GetPawn()) { return; } // e.g. if not possessing
1 Like

Thank you so much for the help, that does solve the problem.

But I don’t understand why this can affect the blueprint. Can you explain?

It shouldn’t and I’m not entirely sure why it does in your case.

i had same issue.

im guessing it crashes because the c++ code runs even though the pawn doesnt exist on the first tick and causes some sort of bug with the blueprint

So this works, I am looking at this and thinking it is basically the same as all the other protections we have been putting on our pointers?? Because we are pointing the pawn to Finding the component, so like other pointers we must protect it like we do the others. Is this true?

You mean dereferencing the Pawn returned from GetPawn? Then yes, it’s a bug

https://issues.unrealengine.com/issue/UE-36929

Well i am still very new to this all, so i am still learning. Thank you for the help anyways.

Privacy & Terms