|
@@ -492,12 +492,14 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
|
|
|
required ButtonAction? buttonAction,
|
|
|
Exception? exception,
|
|
|
}) {
|
|
|
- if (Navigator.of(context).canPop()) {
|
|
|
- Navigator.of(context).pop(ButtonResult(widget.buttonAction, exception));
|
|
|
- } else if (exception != null) {
|
|
|
- //This is to show the execution was unsuccessful if the dialog is manually
|
|
|
- //closed before the execution completes.
|
|
|
- showGenericErrorDialog(context: context);
|
|
|
+ if (mounted) {
|
|
|
+ if (Navigator.of(context).canPop()) {
|
|
|
+ Navigator.of(context).pop(ButtonResult(widget.buttonAction, exception));
|
|
|
+ } else if (exception != null) {
|
|
|
+ //This is to show the execution was unsuccessful if the dialog is manually
|
|
|
+ //closed before the execution completes.
|
|
|
+ showGenericErrorDialog(context: context);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|