From c2598b0188942ad3f844fc7d100630ede838dedf Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Thu, 9 May 2024 15:59:37 -0400 Subject: [PATCH] [BUGFIX] sonarcloud typescript:S6582 fixed. Prefer using an optional chain expression instead, as it's more concise and easier to read. --- src/projecteuler/lib/BNodeBuilder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(