Want to know the reason of the crash

Hi everyone… I was getting a weird crash but I was able to fix it. I want to know the reason of why I was getting the crash.

Here is the code that. I am removing the non relevant parts.


	FVector OrbitVect = RandStream.VRand();
	OrbitVect.Z = OrbitVect.Z / 45; // Makes the orbits flat
	FRotator RevTilt = OrbitVect.Rotation();
	FPlanetDataBase FirstPlanet(FirstPlanetDis, RevTilt.Quaternion(), 1, Angle, RevRate);
	for (int32 i = 1; i < NoOfPlanets; i++)
	{
		OrbitVect = RandStream.VRand();
		OrbitVect.Z = OrbitVect.Z / 45;
		RevTilt = OrbitVect.Rotation();
		FPlanetDataBase NewPlanet(NewDistance, RevTilt.Quaternion(), LastIndex + 1, Angle, RevRate); // This caused the crash
		TempStruct.Planets.Add(NewPlanet);
	}

The code compiled fine but when I played the game, the engine crashed with error line shown as above.

I solved it by this method and this works.


	FVector OrbitVect = RandStream.VRand();
	OrbitVect.Z = OrbitVect.Z / 45; // Makes the orbits flat
	FRotator RevTilt = OrbitVect.Rotation();
	FPlanetDataBase FirstPlanet(FirstPlanetDis, RevTilt.Quaternion(), 1, Angle, RevRate);
	for (int32 i = 1; i < NoOfPlanets; i++)
	{
		OrbitVect = RandStream.VRand();
		OrbitVect.Z = OrbitVect.Z / 45;
		RevTilt = OrbitVect.Rotation();
                FQuat NewQuat = RevTilt.Quaternion();
		FPlanetDataBase NewPlanet(NewDistance, NewQuat, LastIndex + 1, Angle, RevRate); // This caused the crash
		TempStruct.Planets.Add(NewPlanet);
	}

Any reason what was causing the crash?

my only guess is that RevTilt.Quaternion() is still considered a rotator when passed into the function.

Which version of the engine itself are you compiling against?
There’ve been a few issues with FQuats causing crashes in release builds due to SSE optimisations expecting data to be aligned - eg https://answers.unrealengine.com/questions/125784/doing-a-fquatfquat-when-one-of-them-is-a-parameter.html .
If the issue is occurring in Debug builds for you, this probably isn’t related, but if you’re using a binary release or are building in Development/shipping, would you mind looking at the disassembly where the crash occurs and pasting it here?
If it’s the same issue, the crash will occur on a movaps instruction or another one expecting aligned operands.

I am using 4.5.0 version. I am using the Binary release and Development Editor. I will into the disassmebly and paste it here.