Skip to content

Commit

Permalink
Merge pull request #1388 from akto-api-security/hotfix/dep_flow_null_…
Browse files Browse the repository at this point in the history
…connections

fixed null pointer in dep flow
  • Loading branch information
avneesh-akto authored Aug 22, 2024
2 parents da8fb0b + b5412b4 commit 36f206f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void parseTree() {
// resultNode is basically find which node is receiving the data and fill the edge with that particular parameter
ApiInfo.ApiInfoKey resultApiInfoKey = new ApiInfo.ApiInfoKey(Integer.parseInt(reverseEdge.getApiCollectionId()), reverseEdge.getUrl(), URLMethods.Method.fromString(reverseEdge.getMethod()));
Node resultNode = resultNodes.get(resultApiInfoKey);
if (resultNode == null) continue;
if (done.contains(resultApiInfoKey)) continue;
Edge edge = new Edge(reverseNode.getApiCollectionId(), reverseNode.getUrl(), reverseNode.getMethod(), reverseConnection.getParam(), reverseEdge.getIsHeader(), reverseEdge.getCount(), depth + 1);
String requestParam = reverseEdge.getParam();
Expand All @@ -172,10 +173,12 @@ public void parseTree() {
requestParam += "_isHeader";
}

Connection connection = resultNode.getConnections().get(requestParam);
Map<String, Connection> resultNodeconnections = resultNode.getConnections();
if (resultNodeconnections == null) resultNodeconnections = new HashMap<>();
Connection connection = resultNodeconnections.get(requestParam);
if (connection == null) {
connection = new Connection(edge.getParam(), new ArrayList<>(), reverseEdge.isUrlParam(), reverseEdge.getIsHeader());
resultNode.getConnections().put(reverseEdge.getParam(), connection);
resultNodeconnections.put(reverseEdge.getParam(), connection);
}
connection.getEdges().add(edge);

Expand Down

0 comments on commit 36f206f

Please sign in to comment.