From f547be16dfeecb1e6271982788af75a079351f7c Mon Sep 17 00:00:00 2001 From: Jan Koehnlein Date: Tue, 22 Aug 2017 16:18:03 +0200 Subject: [PATCH] [server] another NPE guard --- .../server/xtext/tracing/TraceRegionProvider.xtend | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/xtext-diagram/src/main/java/io/typefox/sprotty/server/xtext/tracing/TraceRegionProvider.xtend b/server/xtext-diagram/src/main/java/io/typefox/sprotty/server/xtext/tracing/TraceRegionProvider.xtend index c6ef0b0..dd6031a 100644 --- a/server/xtext-diagram/src/main/java/io/typefox/sprotty/server/xtext/tracing/TraceRegionProvider.xtend +++ b/server/xtext-diagram/src/main/java/io/typefox/sprotty/server/xtext/tracing/TraceRegionProvider.xtend @@ -35,10 +35,12 @@ class TraceRegionProvider { def TextRegion getSignificantRegion(EObject element) { val feature = element.relevantFeature - if (feature !== null) - return NodeModelUtils.findNodesForFeature(element, feature).head.toTextRegion - else - return NodeModelUtils.findActualNodeFor(element).toTextRegion + if (feature !== null) { + val node = NodeModelUtils.findNodesForFeature(element, feature).head + if(node !== null) + return node.toTextRegion + } + return NodeModelUtils.findActualNodeFor(element).toTextRegion } protected def toTextRegion(INode node) {