Project has no crashes in editor but crashes when built for standalone

Hello,

I have recently been converting a lot of logic into CPP for a project I am working on, in the editor when I run my project the code I have written runs fine but when the project is built it crashes when I do a specific action. I have attached below the function I believe that is crashing only when built and a copy of the client.log output relevant to the crash. I don’t have much experience debugging outside of the editor and would like any direction someone could provide me.

FItem UInventoryComponent::AddOre(FItem item, UPARAM(ref) FOreInventory& oreInv)
{
	UpdateCurrentCapacity(oreInv);
	float spaceAvailable = oreInv.TotalCapacity - oreInv.CurrentCapacity;

	if (spaceAvailable > 0.0f)
	{
		if (spaceAvailable >= item.Quantity)
		{
			for (int i = 0; i < oreInv.FItems.Num(); i++)
			{
				if (oreInv.FItems[i].UniqueId == item.UniqueId) {
					oreInv.FItems[i].Quantity += item.Quantity;
					item.Quantity = 0.0f;
					UpdateCurrentCapacity(oreInv);
					return item;
				}
			}
			oreInv.FItems.Add(item);
			item.Quantity = 0.0f;
			UpdateCurrentCapacity(oreInv);
			UE_LOG(LogTemp, Warning, TEXT("We added the item to the inventory and we are returning a copy with a 0 for the quantity"));
			return item;
		}
		else
		{
			float leftover = item.Quantity - spaceAvailable;
			item.Quantity = spaceAvailable;
			for (int i = 0; i < oreInv.FItems.Num(); i++)
			{
				if (oreInv.FItems[i].UniqueId == item.UniqueId) {
					oreInv.FItems[i].Quantity += item.Quantity;
					item.Quantity = leftover;
					UpdateCurrentCapacity(oreInv);
					return item;
				}
			}
			oreInv.FItems.Add(item);
			item.Quantity = leftover;
			UpdateCurrentCapacity(oreInv);
			return item;
		}
	}
	else
	{
		UpdateCurrentCapacity(oreInv);
		return item;
	}
}

FItem UInventoryComponent::RemoveOre(FItem item, UPARAM(ref)FOreInventory& oreInv)
{
	for (int i = 0; i < oreInv.FItems.Num(); i++)
	{
		if (oreInv.FItems[i].UniqueId == item.UniqueId)
		{
			//there is enough to fill remove request
			if (oreInv.FItems[i].Quantity >= item.Quantity)
			{
				oreInv.FItems[i].Quantity -= item.Quantity;
				if (oreInv.FItems[i].Quantity <= 0)
				{
					oreInv.FItems.RemoveAt(i);
				}
				UpdateCurrentCapacity(oreInv);
				return item;
			}
			//there is not enough but there is some
			else
			{
				item.Quantity = oreInv.FItems[i].Quantity;
				oreInv.FItems.RemoveAt(i);
				UpdateCurrentCapacity(oreInv);
				return item;
			}
		}
	}
	//should only hit this if we didnt find it at all and returns a new copy with a default value of -1 for quantity
	UpdateCurrentCapacity(oreInv);
	return FItem();
}

void UInventoryComponent::UpdateCurrentCapacity(UPARAM(ref)FOreInventory& oreInv)
{
	oreInv.CurrentCapacity = 0;

	for (int i = 0; i < oreInv.FItems.Num(); i++)
	{
		oreInv.CurrentCapacity += oreInv.FItems[i].Quantity;
	}
}
Script Stack (2 frames) :
/Game/SimpleMiner/Core/Characters/PlayerCharacter/BP_MainPlayerCharacter.BP_MainPlayerCharacter_C.ExecuteUbergraph_BP_MainPlayerCharacter
/Game/SimpleMiner/Core/Characters/PlayerCharacter/BP_MainPlayerCharacter.BP_MainPlayerCharacter_C.InpActEvt_IA_Interact_K2Node_EnhancedInputActionEvent_1

[2023.09.28-00.56.07:891][153]LogWindows: Error: appError called: Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\HAL\MallocBinned2.cpp] [Line: 1438] 
FMallocBinned2 Attempt to realloc an unrecognized block 00007FF752D20000   canary == 0x8b != 0xe3



[2023.09.28-00.56.07:891][153]LogWindows: Windows GetLastError: The operation completed successfully. (0)
[2023.09.28-00.56.14:980][153]LogWindows: Could not start crash report client using ../../../Engine/Binaries/Win64/CrashReportClient-Win64-Debug.exe
[2023.09.28-00.56.14:980][153]LogMemory: Platform Memory Stats for Windows
[2023.09.28-00.56.14:980][153]LogMemory: Process Physical Memory: 1181.12 MB used, 1182.20 MB peak
[2023.09.28-00.56.14:980][153]LogMemory: Process Virtual Memory: 3500.29 MB used, 3501.26 MB peak
[2023.09.28-00.56.14:980][153]LogMemory: Physical Memory: 25024.82 MB used,  40434.18 MB free, 65459.00 MB total
[2023.09.28-00.56.14:980][153]LogMemory: Virtual Memory: 39724.09 MB used,  29830.91 MB free, 69555.00 MB total
[2023.09.28-00.56.14:980][153]Message dialog closed, result: Ok, title: The UE-SimpleMiner Game has crashed and will close, text: Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\HAL\MallocBinned2.cpp] [Line: 1438] 
FMallocBinned2 Attempt to realloc an unrecognized block 00007FF752D20000   canary == 0x8b != 0xe3



[2023.09.28-00.56.14:980][153]LogWindows: Error: begin: stack for UAT
[2023.09.28-00.56.14:980][153]LogWindows: Error: === Critical error: ===
[2023.09.28-00.56.14:980][153]LogWindows: Error: 
[2023.09.28-00.56.14:980][153]LogWindows: Error: Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\HAL\MallocBinned2.cpp] [Line: 1438] 
[2023.09.28-00.56.14:980][153]LogWindows: Error: FMallocBinned2 Attempt to realloc an unrecognized block 00007FF752D20000   canary == 0x8b != 0xe3
[2023.09.28-00.56.14:980][153]LogWindows: Error: 
[2023.09.28-00.56.14:980][153]LogWindows: Error: 
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff75228fd53 SimpleMiner-Win64-DebugGame.exe!FMallocBinned2::GetAllocationSizeExternal() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff7522ff850 SimpleMiner-Win64-DebugGame.exe!FMallocPoisonProxy::Free() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff7522ffd71 SimpleMiner-Win64-DebugGame.exe!FMemory::Free() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff7595bcca0 SimpleMiner-Win64-DebugGame.exe!UInventoryComponent::AddOre() [C:\Users\Jdubs\Documents\Unreal Projects\SimpleMiner\Source\SimpleMiner\Private\InventoryComponent.cpp:45]
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff7595b7d1b SimpleMiner-Win64-DebugGame.exe!UInventoryComponent::execAddOre() [C:\Users\Jdubs\Documents\Unreal Projects\SimpleMiner\Intermediate\Build\Win64\UnrealGame\Inc\SimpleMiner\UHT\InventoryComponent.gen.cpp:63]
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff75d31fcc8 SimpleMiner-Win64-DebugGame.exe!`string'() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x0000027622fe4000 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752dc30b8 SimpleMiner-Win64-DebugGame.exe!UObject::execInstanceVariable() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00000276239d4898 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00000276239d48b0 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00000276239d48c8 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff76014a740 SimpleMiner-Win64-DebugGame.exe!GNatives() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00008f1e515b5f92 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff76014a740 SimpleMiner-Win64-DebugGame.exe!GNatives() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00000276239d4940 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x000000edaeb78200 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x0000027621d321c0 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x000000edaeb77c40 UnknownFunction []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752d947d5 SimpleMiner-Win64-DebugGame.exe!UObject::ProcessContextOpcode() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752dc3c65 SimpleMiner-Win64-DebugGame.exe!UObject::execLet() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752d98938 SimpleMiner-Win64-DebugGame.exe!ProcessLocalScriptFunction() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752d6c67d SimpleMiner-Win64-DebugGame.exe!ProcessScriptFunction<void (__cdecl*)(UObject * __ptr64,FFrame & __ptr64,void * __ptr64)>() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752d98370 SimpleMiner-Win64-DebugGame.exe!ProcessLocalFunction() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752d98938 SimpleMiner-Win64-DebugGame.exe!ProcessLocalScriptFunction() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752d979e4 SimpleMiner-Win64-DebugGame.exe!UObject::ProcessInternal() []
[2023.09.28-00.56.14:980][153]LogWindows: Error: [Callstack] 0x00007ff752ae8359 SimpleMiner-Win64-DebugGame.exe!UFunction::Invoke() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff752d96561 SimpleMiner-Win64-DebugGame.exe!UObject::ProcessEvent() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff75766d902 SimpleMiner-Win64-DebugGame.exe!AActor::ProcessEvent() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff7536c7af7 SimpleMiner-Win64-DebugGame.exe!TScriptDelegate<FNotThreadSafeDelegateMode>::ProcessDelegate<UObject>() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff75aca7882 SimpleMiner-Win64-DebugGame.exe!FEnhancedInputActionEventDelegateBinding<FEnhancedInputActionHandlerDynamicSignature>::Execute() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff75aca61c6 SimpleMiner-Win64-DebugGame.exe!UEnhancedPlayerInput::EvaluateInputDelegates() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff758e913d2 SimpleMiner-Win64-DebugGame.exe!UPlayerInput::ProcessInputStack() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff75879d57d SimpleMiner-Win64-DebugGame.exe!APlayerController::ProcessPlayerInput() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff7587b9fba SimpleMiner-Win64-DebugGame.exe!APlayerController::TickPlayerInput() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff75879b97b SimpleMiner-Win64-DebugGame.exe!APlayerController::PlayerTick() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff7587b89b4 SimpleMiner-Win64-DebugGame.exe!APlayerController::TickActor() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff75765251c SimpleMiner-Win64-DebugGame.exe!FActorTickFunction::ExecuteTick() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff758ce167f SimpleMiner-Win64-DebugGame.exe!FTickFunctionTask::DoTask() []
[2023.09.28-00.56.14:981][153]LogWindows: Error: [Callstack] 0x00007ff758ce7ac7 SimpleMiner-Win64-DebugGame.exe!TGraphTask<FTickFunctionTask>::ExecuteTask() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff752177fd7 SimpleMiner-Win64-DebugGame.exe!FNamedTaskThread::ProcessTasksNamedThread() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff7521785ce SimpleMiner-Win64-DebugGame.exe!FNamedTaskThread::ProcessTasksUntilQuit() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff75218327d SimpleMiner-Win64-DebugGame.exe!FTaskGraphCompatibilityImplementation::WaitUntilTasksComplete() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff758cfb5ee SimpleMiner-Win64-DebugGame.exe!FTickTaskSequencer::ReleaseTickGroup() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff758d01394 SimpleMiner-Win64-DebugGame.exe!FTickTaskManager::RunTickGroup() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff758247e68 SimpleMiner-Win64-DebugGame.exe!UWorld::RunTickGroup() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff758251210 SimpleMiner-Win64-DebugGame.exe!UWorld::Tick() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff757fb9221 SimpleMiner-Win64-DebugGame.exe!UGameEngine::Tick() []
[2023.09.28-00.56.14:982][153]LogWindows: Error: [Callstack] 0x00007ff7595888f3 SimpleMiner-Win64-DebugGame.exe!FEngineLoop::Tick() []
[2023.09.28-00.56.14:983][153]LogWindows: Error: [Callstack] 0x00007ff7595a062c SimpleMiner-Win64-DebugGame.exe!GuardedMain() []
[2023.09.28-00.56.14:983][153]LogWindows: Error: [Callstack] 0x00007ff7595a070a SimpleMiner-Win64-DebugGame.exe!GuardedMainWrapper() []
[2023.09.28-00.56.14:983][153]LogWindows: Error: [Callstack] 0x00007ff7595a35b6 SimpleMiner-Win64-DebugGame.exe!LaunchWindowsStartup() []
[2023.09.28-00.56.14:983][153]LogWindows: Error: [Callstack] 0x00007ff7595b31b4 SimpleMiner-Win64-DebugGame.exe!WinMain() []
[2023.09.28-00.56.14:983][153]LogWindows: Error: [Callstack] 0x00007ff75ce42c3a SimpleMiner-Win64-DebugGame.exe!__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
[2023.09.28-00.56.14:983][153]LogWindows: Error: [Callstack] 0x00007ff88f33257d KERNEL32.DLL!UnknownFunction []
[2023.09.28-00.56.14:983][153]LogWindows: Error: 
[2023.09.28-00.56.14:983][153]LogWindows: Error: end: stack for UAT
[2023.09.28-00.56.14:991][153]LogExit: Executing StaticShutdownAfterError
[2023.09.28-00.56.14:992][153]LogWindows: FPlatformMisc::RequestExit(1, LaunchWindowsStartup.ExceptionHandler)
[2023.09.28-00.56.14:992][153]LogWindows: FPlatformMisc::RequestExitWithStatus(1, 3, LaunchWindowsStartup.ExceptionHandler)
[2023.09.28-00.56.14:992][153]LogCore: Engine exit requested (reason: Win RequestExit)