PathFinding.js icon indicating copy to clipboard operation
PathFinding.js copied to clipboard

Error: TypeError: Cannot set properties of undefined (setting 'g')

Open Stevenbdl opened this issue 4 years ago • 1 comments

Issue path: src/finders/JumpPointFinderBase.js

Issue detailed Line where is issue

My solution: startNode = this.startNode = grid.getNodeAt(startX, startY) || {}

Stevenbdl avatar Oct 20 '21 21:10 Stevenbdl

None of the methods check if you picked a point inside of the grid, they all expect you to make sure you only pick start position and end position that is inside of the grid.

Your solutions only avoids the exception, but since the algorithm will never be able to find a path that leads outside of the grid you would be better off just canceling the pathfinding operation right away.

Anyway I don't think this lib needs to handle that for you.

ZoranRavic avatar Oct 01 '22 16:10 ZoranRavic