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!;
|
final wopiSession = snapshot.data!;
|
||||||
|
|
||||||
// Use backend proxy endpoint to serve the Collabora form
|
// Use backend proxy endpoint to serve the Collabora form
|
||||||
|
|||||||
@@ -811,7 +811,9 @@ class _FileExplorerState extends State<FileExplorer> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final result = await FilePicker.platform
|
final result = await FilePicker.platform
|
||||||
.pickFiles(withData: true);
|
.pickFiles(withData: true);
|
||||||
if (result != null && result.files.isNotEmpty) {
|
if (result != null &&
|
||||||
|
result.files.isNotEmpty &&
|
||||||
|
context.mounted) {
|
||||||
final files = result.files
|
final files = result.files
|
||||||
.map(
|
.map(
|
||||||
(file) => FileItem(
|
(file) => FileItem(
|
||||||
@@ -849,7 +851,8 @@ class _FileExplorerState extends State<FileExplorer> {
|
|||||||
final folderName =
|
final folderName =
|
||||||
await _showCreateFolderDialog(context);
|
await _showCreateFolderDialog(context);
|
||||||
if (folderName != null &&
|
if (folderName != null &&
|
||||||
folderName.isNotEmpty) {
|
folderName.isNotEmpty &&
|
||||||
|
context.mounted) {
|
||||||
context.read<FileBrowserBloc>().add(
|
context.read<FileBrowserBloc>().add(
|
||||||
CreateFolder(
|
CreateFolder(
|
||||||
orgId: widget.orgId,
|
orgId: widget.orgId,
|
||||||
|
|||||||
Reference in New Issue
Block a user