diff --git a/packages/flutter/lib/widgets/widget.dart b/packages/flutter/lib/widgets/widget.dart index 60efa0a24b5..dcab05d7437 100644 --- a/packages/flutter/lib/widgets/widget.dart +++ b/packages/flutter/lib/widgets/widget.dart @@ -887,8 +887,8 @@ abstract class RenderObjectWrapper extends Widget { if (parentData != null) { assert(root.parentData != null); root.parentData.merge(parentData); // this will throw if the types aren't appropriate - if (parent.root != null) - parent.root.markNeedsLayout(); + if (ancestor != null && ancestor.root != null) + ancestor.root.markNeedsLayout(); } }