Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
MapMagic World Generator
MapMagic World Generator
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 157
    • Issues 157
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Requirements
    • Requirements
    • List
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards
  • Denis Pahunov
  • MapMagic World GeneratorMapMagic World Generator
  • Issues
  • #339

Closed
Open
Opened Jul 18, 2020 by Jason R. Surratt@jasonsurratt

Null pointer exception in SplineSys.GetClosest

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.

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;
                }
            }
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: denispahunov/mapmagic#339