From 5e7c40c1d5a9427267dcfad6f749b064fc8f9cc2 Mon Sep 17 00:00:00 2001 From: Avneesh Hota Date: Thu, 22 Aug 2024 11:16:21 +0530 Subject: [PATCH] fixed null pointer --- .../java/com/akto/dto/dependency_flow/DependencyFlow.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/dao/src/main/java/com/akto/dto/dependency_flow/DependencyFlow.java b/libs/dao/src/main/java/com/akto/dto/dependency_flow/DependencyFlow.java index 5e4a9cc644..80e947cb81 100644 --- a/libs/dao/src/main/java/com/akto/dto/dependency_flow/DependencyFlow.java +++ b/libs/dao/src/main/java/com/akto/dto/dependency_flow/DependencyFlow.java @@ -153,6 +153,7 @@ public void parseTree() { } Node nodeFromQueue = resultNodes.get(apiInfoKey); + if (nodeFromQueue == null) continue; nodeFromQueue.fillMaxDepth(); int depth = nodeFromQueue.getMaxDepth(); @@ -237,7 +238,9 @@ public ApiInfo.ApiInfoKey markNodeAsDone() { ApiInfo.ApiInfoKey childApi = new ApiInfo.ApiInfoKey(Integer.parseInt(reverseEdge.getApiCollectionId()), reverseEdge.getUrl(), URLMethods.Method.fromString(reverseEdge.getMethod())); Node resultNode = resultNodes.get(childApi); + if (resultNode == null) continue; Map connections = resultNode.getConnections(); + if (connections == null) continue; String param = reverseEdge.getParam(); if (reverseEdge.getIsHeader()) { @@ -270,6 +273,7 @@ public ApiInfo.ApiInfoKey markNodeAsDone() { ApiInfo.ApiInfoKey apiInfoKey = generateApiInfoKeyFromString(apiInfoKeyString); Node node = resultNodes.get(apiInfoKey); + if (node == null) continue; Map connections = node.getConnections(); int missing = 0; int filled = 0; @@ -289,7 +293,7 @@ public ApiInfo.ApiInfoKey markNodeAsDone() { if (missing < currentMinMissingCount) result = apiInfoKey; } - if (result != null) { + if (result != null && resultNodes.get(result) != null) { logger.info(resultNodes.get(result).getUrl() + " is being marked done"); }