From 9866a4edb2102775d709d7b28b301bbf7f02083d Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Thu, 2 May 2019 12:00:01 -0700 Subject: [PATCH] Fix NPE --- .../TypeBasedYamlHierarchicalSymbolHandler.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/reconcile/TypeBasedYamlHierarchicalSymbolHandler.java b/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/reconcile/TypeBasedYamlHierarchicalSymbolHandler.java index a59b911c3..e7cd18cf3 100644 --- a/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/reconcile/TypeBasedYamlHierarchicalSymbolHandler.java +++ b/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/reconcile/TypeBasedYamlHierarchicalSymbolHandler.java @@ -75,11 +75,13 @@ public class TypeBasedYamlHierarchicalSymbolHandler implements HierarchicalDocum IDocument doc = currentAst.getDocument(); if (namePath!=null) { Node nameNode = namePath.traverseNode(node); - return new DocumentSymbol(NodeUtil.asScalar(nameNode), kind, - NodeUtil.region(doc, node).asRange(), - NodeUtil.region(doc, nameNode).asRange(), - detail - ); + if (nameNode!=null) { + return new DocumentSymbol(NodeUtil.asScalar(nameNode), kind, + NodeUtil.region(doc, node).asRange(), + NodeUtil.region(doc, nameNode).asRange(), + detail + ); + } } else { //If there's no 'namePath' then we will assume the node we found is the value of a map entry... //and use the map's key as the symbol's name