71place
0 votes Vote

Null pointer exception in SplineSys.GetClosest

I'm using MapMagic v2.0.5 with objects, biomes & splines

Steps to reproduce:
1. Create a map with 5 or more points to connect with splines
2. 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.

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;
}
}
```

jsurratt, 20.07.2020, 16:23
Idea status: under consideration

Comments

Leave a comment