Skip to content

Commit

Permalink
[Truffle] Avoid an NPE when fetching the source section from a child …
Browse files Browse the repository at this point in the history
…of an optimized LoopNode.
  • Loading branch information
nirvdrum committed Nov 1, 2016
1 parent e93d9c7 commit e1a2252
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -242,7 +242,13 @@ public SourceSection getSourceSection() {
if (sourceStartLine == 0) {
return null;
} else {
return getRubySourceSection().toSourceSection(getRootNode().getSourceSection().getSource());
final RootNode rootNode = getRootNode();

if (rootNode == null) {
return null;
}

return getRubySourceSection().toSourceSection(rootNode.getSourceSection().getSource());
}
}

Expand Down

0 comments on commit e1a2252

Please sign in to comment.