Problem translating Blueprint to C++ TMap

Im trying to translate this blueprint function to code but its not working at all


void ULyraInventoryManagerComponent::DoesShapeFit(TArray<FVector2D> Shape, bool& bSuccess, FVector2D& ResultVec)
{
	FVector2D EmptySlot = FVector2D::ZeroVector;
	bool bFailed = false;
	
	TArray<FVector2D> Locations;
	InventoryState.GetKeys(Locations);

	for (int j = 0; j < Locations.Num(); j++)
	{
		FVector2D Location = Locations[j];
		bool* bFound = InventoryState.Find(Location - Shape[0]);

		if (bFound)
		{
			if (!(*bFound))
			{
				EmptySlot = Location;

				for (int i = 0; i < Shape.Num(); i++)
				{
					bool* FoundValue = InventoryState.Find(EmptySlot + Shape[i]);

					bool bCondition = (!FoundValue || !(*FoundValue));
				
					if (bCondition)
					{
						bFailed = true;
						break;
					}
				}
				if (bFailed)
				{
					bFailed = false;
				}
				else
				{
					bSuccess = true;
					ResultVec = EmptySlot;
					return;
				}
			}
		}
		
	}
	
	bSuccess = false;
	ResultVec = FVector2D::ZeroVector;
		
}