Add context.mounted checks in file explorer for safer file and folder operations
This commit is contained in:
@@ -417,6 +417,7 @@ class _DocumentViewerModalState extends State<DocumentViewerModal> {
|
||||
);
|
||||
}
|
||||
|
||||
// ignore: unused_local_variable
|
||||
final wopiSession = snapshot.data!;
|
||||
|
||||
// Use backend proxy endpoint to serve the Collabora form
|
||||
|
||||
@@ -811,7 +811,9 @@ class _FileExplorerState extends State<FileExplorer> {
|
||||
onPressed: () async {
|
||||
final result = await FilePicker.platform
|
||||
.pickFiles(withData: true);
|
||||
if (result != null && result.files.isNotEmpty) {
|
||||
if (result != null &&
|
||||
result.files.isNotEmpty &&
|
||||
context.mounted) {
|
||||
final files = result.files
|
||||
.map(
|
||||
(file) => FileItem(
|
||||
@@ -849,7 +851,8 @@ class _FileExplorerState extends State<FileExplorer> {
|
||||
final folderName =
|
||||
await _showCreateFolderDialog(context);
|
||||
if (folderName != null &&
|
||||
folderName.isNotEmpty) {
|
||||
folderName.isNotEmpty &&
|
||||
context.mounted) {
|
||||
context.read<FileBrowserBloc>().add(
|
||||
CreateFolder(
|
||||
orgId: widget.orgId,
|
||||
|
||||
Reference in New Issue
Block a user