From de21a09ce74bbc8b39d00acdeea434b779a9fcd9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 17:09:55 +0000 Subject: [PATCH 1/3] Initial plan From aab5327b778c227cc3c72f39d53450e94321c8ad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 17:16:47 +0000 Subject: [PATCH 2/3] Fix "Bad state: No element" error by checking if paths is empty Co-authored-by: AlexV525 <15884415+AlexV525@users.noreply.github.com> --- lib/src/delegates/asset_picker_builder_delegate.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/src/delegates/asset_picker_builder_delegate.dart b/lib/src/delegates/asset_picker_builder_delegate.dart index e1113823..590282bf 100644 --- a/lib/src/delegates/asset_picker_builder_delegate.dart +++ b/lib/src/delegates/asset_picker_builder_delegate.dart @@ -1081,6 +1081,9 @@ class DefaultAssetPickerBuilderDelegate } await provider.getPaths(keepPreviousCount: true); + if (provider.paths.isEmpty) { + return; + } provider.currentPath = provider.paths.first; final currentWrapper = provider.currentPath; if (currentWrapper != null) { From abacd02ba990413e2220b8bea27d61cee4fc89ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 17:53:22 +0000 Subject: [PATCH 3/3] Add changelog entry for the crash fix Co-authored-by: AlexV525 <15884415+AlexV525@users.noreply.github.com> --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49532d61..3d7f4363 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ that can be found in the LICENSE file. --> **Fixes** - Refactor drag selection to work across all pages globally. +- Fix "Bad state: No element" crash in `onAssetsChanged` when paths list is empty. ## 10.0.0