Steps to reproduce:
Create three objects - A, B, C:
Object A has Y = 0;
Object B has Y = 0 and is child of A;
Object C has Y = 0.
Result: upon running the room engine will throw System.NullReferenceException, stack trace:
AGS.Engine.RenderOrderSelector.getZ(AGS.API.IObject obj) Line 119
AGS.Engine.RenderOrderSelector.compareObj(AGS.API.IObject o1, AGS.API.IObject o2) Line 71
AGS.Engine.RenderOrderSelector.compare(AGS.API.IObject s1, AGS.API.IObject s2) Line 52
AGS.Engine.RenderOrderSelector.Compare(AGS.API.IObject s1, AGS.API.IObject s2) Line 20
Basically, what happens is that object with parent is compared with another object which has no parent and is not the parent nor child of the first object.
This code:
IObject newParent1 = getNewParent(parent1, s1);
IObject newParent2 = getNewParent(parent2, s2);
if (newParent1 != newParent2)
{
float result = compareObj(newParent1, newParent2); <------ crashes here
if (result != 0f) return result;
}
if (newParent1 == null || newParent2 == null || (newParent1 == s1 && newParent2 == s2))
{
//Trying to avoid ambiguity, so using X as a last resort
return getX(s2) - getX(s1);
}
Steps to reproduce: Create three objects - A, B, C:
Result: upon running the room engine will throw System.NullReferenceException, stack trace:
Basically, what happens is that object with parent is compared with another object which has no parent and is not the parent nor child of the first object.
This code: