Skip to content

Commit

Permalink
Fix potential null dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
cgestes committed May 23, 2020
1 parent e715afe commit 95d03f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/notus/lib/src/document/node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ abstract class Node extends LinkedListEntry<Node> {

/// Offset in characters of this node in the document.
int get documentOffset {
final parentOffset = (_parent is! RootNode) ? _parent.documentOffset : 0;
final parentOffset =
(_parent is! RootNode && _parent != null) ? _parent.documentOffset : 0;
return parentOffset + offset;
}

Expand Down

0 comments on commit 95d03f1

Please sign in to comment.