From c8bbb522c512dd1c10f883b66d49768ffbe2a428 Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Tue, 25 Aug 2020 13:01:03 -0700 Subject: [PATCH] Protect against null context in release mode (#64474) --- packages/flutter/lib/src/widgets/actions.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/widgets/actions.dart b/packages/flutter/lib/src/widgets/actions.dart index 7b5b5ef4af1..aa6399346fb 100644 --- a/packages/flutter/lib/src/widgets/actions.dart +++ b/packages/flutter/lib/src/widgets/actions.dart @@ -454,7 +454,7 @@ class Actions extends StatefulWidget { // getElementForInheritedWidgetOfExactType. Returns true if the visitor found // what it was looking for. static bool _visitActionsAncestors(BuildContext context, bool visitor(InheritedElement element)) { - InheritedElement actionsElement = context.getElementForInheritedWidgetOfExactType<_ActionsMarker>(); + InheritedElement actionsElement = context?.getElementForInheritedWidgetOfExactType<_ActionsMarker>(); while (actionsElement != null) { if (visitor(actionsElement) == true) { break; @@ -463,7 +463,7 @@ class Actions extends StatefulWidget { // context.getElementForInheritedWidgetOfExactType will return itself if it // happens to be of the correct type. final BuildContext parent = _getParent(actionsElement); - actionsElement = parent.getElementForInheritedWidgetOfExactType<_ActionsMarker>(); + actionsElement = parent?.getElementForInheritedWidgetOfExactType<_ActionsMarker>(); } return actionsElement != null; }