Skip to content

Commit 1957775

Browse files
author
LocalIdentity
committed
Fix crash on import
I'm not sure if this is an issue due to poe.ninja cluster rendering but for some reason importing some builds show the clusters as being disconnected and it causes a crash
1 parent f23adba commit 1957775

1 file changed

Lines changed: 31 additions & 22 deletions

File tree

src/Classes/PassiveSpec.lua

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -898,30 +898,39 @@ function PassiveSpecClass:BuildPathFromNode(root)
898898
o = o + 1
899899
local curDist = node.pathDist
900900
-- Iterate through all nodes that are connected to this one
901-
for _, other in ipairs(node.linked) do
902-
-- Paths must obey these rules:
903-
-- 1. They must not pass through class or ascendancy class start nodes (but they can start from such nodes)
904-
-- 2. They cannot pass between different ascendancy classes or between an ascendancy class and the main tree
905-
-- The one exception to that rule is that a path may start from an ascendancy node and pass into the main tree
906-
-- This permits pathing from the Ascendant 'Path of the X' nodes into the respective class start areas
907-
-- 3. They must not pass away from mastery nodes
908-
if not other.pathDist then
909-
ConPrintTable(other, true)
901+
for index, other in ipairs(node.linked) do
902+
-- Cluster subgraph rebuilds can replace node objects while retaining IDs.
903+
-- Normalize stale link references to the canonical node object.
904+
local canonicalNode = other and other.id and self.nodes[other.id]
905+
if not canonicalNode then
906+
other = nil
907+
elseif canonicalNode ~= other then
908+
node.linked[index] = canonicalNode
909+
other = canonicalNode
910910
end
911-
if node.type ~= "Mastery" and other.type ~= "ClassStart" and other.type ~= "AscendClassStart" and other.pathDist > curDist and (node.ascendancyName == other.ascendancyName or (curDist == 0 and not other.ascendancyName)) then
912-
-- The shortest path to the other node is through the current node
913-
other.pathDist = curDist
914-
if not other.alloc then
915-
other.pathDist = other.pathDist + 1
916-
end
917-
other.path = wipeTable(other.path)
918-
other.path[1] = other
919-
for i, n in ipairs(node.path) do
920-
other.path[i+1] = n
911+
if other then
912+
-- Paths must obey these rules:
913+
-- 1. They must not pass through class or ascendancy class start nodes (but they can start from such nodes)
914+
-- 2. They cannot pass between different ascendancy classes or between an ascendancy class and the main tree
915+
-- The one exception to that rule is that a path may start from an ascendancy node and pass into the main tree
916+
-- This permits pathing from the Ascendant 'Path of the X' nodes into the respective class start areas
917+
-- 3. They must not pass away from mastery nodes
918+
local otherPathDist = other.pathDist or 1000
919+
if node.type ~= "Mastery" and other.type ~= "ClassStart" and other.type ~= "AscendClassStart" and otherPathDist > curDist and (node.ascendancyName == other.ascendancyName or (curDist == 0 and not other.ascendancyName)) then
920+
-- The shortest path to the other node is through the current node
921+
other.pathDist = curDist
922+
if not other.alloc then
923+
other.pathDist = other.pathDist + 1
924+
end
925+
other.path = wipeTable(other.path)
926+
other.path[1] = other
927+
for i, n in ipairs(node.path) do
928+
other.path[i+1] = n
929+
end
930+
-- Add the other node to the end of the queue
931+
queue[i] = other
932+
i = i + 1
921933
end
922-
-- Add the other node to the end of the queue
923-
queue[i] = other
924-
i = i + 1
925934
end
926935
end
927936
end

0 commit comments

Comments
 (0)