mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Protect against null context in release mode (#64474)
This commit is contained in:
parent
ed65f5e96c
commit
c8bbb522c5
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user