Null pointer exception in SplineSys.GetClosest
Steps to reproduce:
- Create a map with 5 or more points to connect with splines
- If you reveal enough tiles this will eventually pop up.
^ I realize this isn't great but the solution is below and appears to be simple. If my fix is wrong, lemme know and I'll boil down some simple steps to recreate.
Expected result:
No null pointer exception.
Actual result:
A null pointer exception.
Making this change in SplineSys.GetClosest appears to resolve the issue. I believe cl will always be 0 so ml should be set to l instead.
for (int l = 0; l < lines.Length; l++)
{
(int cl, int cs, float cp, float curDist) = lines[l].GetClosest(distanceFn, point, initialApprox, recursiveApprox);
if (curDist < minDist)
{
minDist = curDist;
// change cl to l
ms = cs; mp = cp; ml = l;
}
}