AMadLad
(A M a d L a d)
March 24, 2026, 7:11pm
1
Here’s what the crash log says:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000000
UnrealEditor_Project_2703!BlueprintFunctionScriptThing::function() [C:\Users\Admin\Documents\Unreal Projects\Project5.0\Source\Project\Private\BlueprintFunctionScriptThing.cpp:42]
UnrealEditor_Project_2703!BlueprintFunctionScriptThing::exefunction() [C:\Users\Admin\Documents\Unreal Projects\Project5.0\Intermediate\Build\Win64\UnrealEditor\Inc\Project\UHT\BlueprintFunctionScriptThing.gen.cpp:135]
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll
I narrowed it down to the player pawn, but not sure why it has to do with it crashing
Dumple1
(Stoyan Dimitrov)
March 25, 2026, 11:07am
3
A M a d L a d:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000000
UnrealEditor_Project_2703!BlueprintFunctionScriptThing::function() [C:\Users\Admin\Documents\Unreal Projects\Project5.0\Source\Project\Private\BlueprintFunctionScriptThing.cpp:42]
UnrealEditor_Project_2703!BlueprintFunctionScriptThing::exefunction() [C:\Users\Admin\Documents\Unreal Projects\Project5.0\Intermediate\Build\Win64\UnrealEditor\Inc\Project\UHT\BlueprintFunctionScriptThing.gen.cpp:135]
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll
I narrowed it down to the player pawn, but not sure why it has to do with it crashing
The problem is a null pointer: you are trying to access a memory pointer that has not been initialized yet, so it is nullptr.
Let’s take a look at this file.
BlueprintFunctionScriptThing.cpp:42
1 Like
AMadLad
(A M a d L a d)
March 25, 2026, 9:00pm
4
{
UNiagaraComponent* particlesystem = UNiagaraFunctionLibrary::SpawnSystemAttached(DebrisSystem, impactobject, NAME_None,FVector::ZeroVector, FRotator::ZeroRotator, EAttachLocation::KeepRelativeOffset, true, true, ENCPoolMethod::None, true);
particlesystem->AttachToComponent(impactobject, FAttachmentTransformRules::SnapToTargetIncludingScale, NAME_None);
if (IsValid(impactobject->GetOwner()))
{
Countsie
(Countsie)
March 25, 2026, 9:22pm
5
To prevent the crash, verify DebrisSystem and impactobject are valid before the spawnsystemattached is called… something along the lines of:
if(!DebrisSystem || !impactobject)
{return;}
Then verify you have a valid particlesystem after you create it, in case it fails to create the system. Add some logging in there to output what you’re missing.
AMadLad
(A M a d L a d)
March 26, 2026, 1:13am
6
like this?
if (IsValid(DebrisSystem)||IsValid(impactobject))
{
UNiagaraComponent* particlesystem = UNiagaraFunctionLibrary::SpawnSystemAttached(DebrisSystem, impactobject, NAME_None,FVector::ZeroVector, FRotator::ZeroRotator, EAttachLocation::KeepRelativeOffset, true, true, ENCPoolMethod::None, true);
if (IsValid(DebrisSystem) || IsValid(impactobject))
{
if (IsValid(DebrisSystem) || IsValid(impactobject))
{
particlesystem->AttachToComponent(impactobject, FAttachmentTransformRules::SnapToTargetIncludingScale, NAME_None);
}
else UE_LOG(LogTemp, Log, TEXT("CrashIndicator"));
if (IsValid(impactobject->GetOwner()))
{
particlesystem->SetNiagaraVariableActor("BuildingModule", impactobject->GetOwner());
}
particlesystem->SetNiagaraVariableFloat("Scale", 1);
UNiagaraDataInterfaceArrayFunctionLibrary::SetNiagaraArrayInt32(
particlesystem,
FName("MeshIndexes"),
meshindexes
);
TArray<int32> rendereditems = UNiagaraDataInterfaceArrayFunctionLibrary::GetNiagaraArrayInt32(
particlesystem,
"MeshIndexes"
);
particlesystem->SetVisibleFlag(true);
for (int i = 0; i < rendereditems.Num() - 1;i++)
{
//UE_LOG(LogTemp, Log, TEXT("Index: %i"), rendereditems[i]);
}
impactobject->SetVisibility(false);
}
else UE_LOG(LogTemp, Log, TEXT("CrashIndicator"));
Countsie
(Countsie)
March 26, 2026, 3:31am
7
You only need to validate them once before they are used to make sure they are pointing to an invalid object before using them. If the object is invalid, it will crash as you’ve seen, you want to catch these situations and handle them.
generally its easier and cleaner to validate inputs at the beginning of the function. If they aren’t valid, early out by 'return’ing. add a log entry in the block with the return so you know why it didn’t complete the function.
then after you create and populate the particlesystem pointer, do a:
if(!particlesystem)
{
UE_LOG(LogTemp, Log, Text("Error creating particle system, invalid"));
return;
}
AMadLad
(A M a d L a d)
March 26, 2026, 3:35am
8
I’ll try that tomorrow and see if it worked
AMadLad
(A M a d L a d)
March 26, 2026, 3:48pm
9
fixed, I tried with that code and without it and the one without it crashed and the other one didn’t, thank you
1 Like