[Effen] fix _ensureDepth to work on root of tree, oops

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1050153002
This commit is contained in:
Hixie 2015-04-01 12:08:06 -07:00
parent 6ff2cfbe82
commit ee63773cd1

View File

@ -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;
}
}
}