Asserting on Uniform Buffer creation

Hello, I am getting a crash in the engine code after creating a uniform buffer where I am passing a Texture2D.

It crashes in this function:

for (int32 i = 0; i < NumResources; ++i)
	NewUniformBuffer->ResourceTable[i] = InResources[i];

Basically it hits the assertion when tries to read InResources[1], it actually has 4 resources. I copying FColors (4 bytes) into a Texture2D in the next way:

FByteBulkData* bulkData = &Texture->PlatformData->Mips[0].BulkData;
uint8* data = (uint8*)bulkData->Lock(LOCK_READ_WRITE); 
int byteSize = SrcPitch*SrcRows;
FMemory::Memcpy(data, SrcData, byteSize);


SrcData holds the pointer to the array of FColor that I am copying into Texture which is a Texture2D.
SrcPitch = 4 * textureSize — The texture is squared so its size is textureSize x textureSize
SrcRows = textureSize