EXCEPTION_ACCESS_VIOLATION reading address 0xffffffffffffffff

void UHighlightManager::UpdateTexture()
{
	if (!HighlightTexture)
	{
		UE_LOG(LogHighlight, Error, TEXT("HighlightTexture doesn't exist? Postponing UpdateTexture()"));
		return;
	}
	bHasTextureUpdate = false;
	HighlightTexture->UpdateResource(); // LINE 39; WHAT IS THE PROBLEM HERE?
	HighlightTexture->UpdateTextureRegions((int32)0, (uint32)1, textureRegions, (uint32)(4 * TextureSize), (uint32)4, (uint8*)TextureData.GetData());
}

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xffffffffffffffff

UE4Editor_GenericTactics_0011!UHighlightManager::UpdateTexture() [D:\My Documents\Unreal\GenericTactics\Source\GenericTactics\Movement\HighlightManager.cpp:39]
UE4Editor_Engine!AActor::TickActor() [D:\Build++UE4\Sync\Engine\Source\Runtime\Engine\Private\Actor.cpp:1092]
UE4Editor_Engine!FActorTickFunction::ExecuteTick() [D:\Build++UE4\Sync\Engine\Source\Runtime\Engine\Private\Actor.cpp:172]
UE4Editor_Engine!FTickFunctionTask::DoTask() [D:\Build++UE4\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:284]
UE4Editor_Engine!TGraphTask::ExecuteTask() [D:\Build++UE4\Sync\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:886]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\Build++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:710]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [D:\Build++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:602]
UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() [D:\Build++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:1532]
UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [D:\Build++UE4\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:564]
UE4Editor_Engine!FTickTaskManager::RunTickGroup() [D:\Build++UE4\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:1585]
UE4Editor_Engine!UWorld::RunTickGroup() [D:\Build++UE4\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:785]
UE4Editor_Engine!UWorld::Tick() [D:\Build++UE4\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1494]
UE4Editor_UnrealEd!UEditorEngine::Tick() [D:\Build++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1736]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [D:\Build++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:426]
UE4Editor!FEngineLoop::Tick() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4921]
UE4Editor!GuardedMain() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:178]
UE4Editor!GuardedMainWrapper() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!LaunchWindowsStartup() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:273]
UE4Editor!WinMain() [D:\Build++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:320]
UE4Editor!__scrt_common_main_seh() [d:\agent_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

It looks like HighlightTexture’s value is ‘-1’.

yup…HighlightTexture is empty (nullptr)

could have sworn if(!HighlightTexture) was functionally equivalent to if(HighlightTexture == nullptr), but last time I used UE4 was 4.22

yes…that should work or the otherwise : if (HighlightTexture) { do something }

Lately I have learned that nullptr check is not enough and may fail in UE.

Always initialize your pointers with some value otherwise they may point to random address:

UMyObject* obj = nullptr;  // raw pointer to NULL
TObjectPtr<UMyObject> obj = nullptr;   // alternative drop in replacement for raw pointers in UE5+, should be auto-initialized with NULL
// Is not pending kill or invalid
if(IsValid(obj))
{
    // Do something...
}
1 Like