diff --git a/framework/fn.dart b/framework/fn.dart index 20a8b1cffac..e01c34ddbc4 100644 --- a/framework/fn.dart +++ b/framework/fn.dart @@ -94,8 +94,12 @@ abstract class UINode { int _nodeDepth; void _ensureDepth() { if (_nodeDepth == null) { - _parent.ensureDepth(); - _nodeDepth = _parent._nodeDepth + 1; + if (_parent != null) { + _parent.ensureDepth(); + _nodeDepth = _parent._nodeDepth + 1; + } else { + _nodeDepth = 0; + } } }