Add context.mounted checks in file explorer for safer file and folder operations

This commit is contained in:
Leon Bösche
2026-01-13 22:26:45 +01:00
parent 47e94995b5
commit c00c1e273d
2 changed files with 6 additions and 2 deletions

View File

@@ -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

View File

@@ -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,