diff --git a/src/projecteuler/lib/BNodeBuilder.ts b/src/projecteuler/lib/BNodeBuilder.ts index ef81bfb9..2a768814 100644 --- a/src/projecteuler/lib/BNodeBuilder.ts +++ b/src/projecteuler/lib/BNodeBuilder.ts @@ -39,7 +39,7 @@ export default class BNodeBuilder extends BNode { if (dataTree[i]?.[j]) { const resultNode = new BNode(dataTree[i][j] + (rootValue ?? 0)); - if (dataTree[i + 1] && dataTree[i + 1][j] && dataTree[i + 1][j + 1]) { + if (dataTree?.[i + 1]?.[j] && dataTree?.[i + 1]?.[j + 1]) { // Next left coordinates: [i + 1][j] resultNode.setLeft( BNodeBuilder.buildBNodeTreeWeight(