From 673e35add5061d07996236d9843ba5975cc8aa67 Mon Sep 17 00:00:00 2001 From: Luis Louis <luis.louis@bairesdev.com> Date: Wed, 20 Oct 2021 17:42:02 -0400 Subject: [PATCH] Solving to problems: TypeError: Cannot read properties of undefined (reading 'x') and Error: TypeError: Cannot set properties of undefined (setting 'g') --- src/finders/JumpPointFinderBase.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/finders/JumpPointFinderBase.js b/src/finders/JumpPointFinderBase.js index e6375879..4fc648dd 100644 --- a/src/finders/JumpPointFinderBase.js +++ b/src/finders/JumpPointFinderBase.js @@ -27,7 +27,7 @@ JumpPointFinderBase.prototype.findPath = function(startX, startY, endX, endY, gr var openList = this.openList = new Heap(function(nodeA, nodeB) { return nodeA.f - nodeB.f; }), - startNode = this.startNode = grid.getNodeAt(startX, startY), + startNode = this.startNode = grid.getNodeAt(startX, startY) || {}, endNode = this.endNode = grid.getNodeAt(endX, endY), node; this.grid = grid; @@ -68,8 +68,8 @@ JumpPointFinderBase.prototype._identifySuccessors = function(node) { var grid = this.grid, heuristic = this.heuristic, openList = this.openList, - endX = this.endNode.x, - endY = this.endNode.y, + endX = this.endNode?.x, + endY = this.endNode?.y, neighbors, neighbor, jumpPoint, i, l, x = node.x, y = node.y,