Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix context being used after the widget has been disposed/deactivated

AmanRajSinghMouryaf77c6669cd5c
diff --git a/mobile/apps/locker/lib/ui/components/file_row_widget.dart b/mobile/apps/locker/lib/ui/components/file_row_widget.dart
index 6241b41f30..139f59f0b6 100644
--- a/mobile/apps/locker/lib/ui/components/file_row_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/file_row_widget.dart
@@ -292,18 +292,21 @@ class FileRowWidget extends StatelessWidget {
}
await dialog.hide();
-
- SnackBarUtils.showInfoSnackBar(
- context,
- context.l10n.fileDeletedSuccessfully,
- );
+ if (context.mounted) {
+ SnackBarUtils.showInfoSnackBar(
+ context,
+ context.l10n.fileDeletedSuccessfully,
+ );
+ }
} catch (e) {
await dialog.hide();
- SnackBarUtils.showWarningSnackBar(
- context,
- context.l10n.failedToDeleteFile(e.toString()),
- );
+ if (context.mounted) {
+ SnackBarUtils.showWarningSnackBar(
+ context,
+ context.l10n.failedToDeleteFile(e.toString()),
+ );
+ }
}
}