From 141cc3fa06a06009321b326d032fe3c3c6cc3ea9 Mon Sep 17 00:00:00 2001 From: Lilian Cadiou Date: Wed, 16 Oct 2024 22:51:43 +0200 Subject: [PATCH 1/3] Fix null safety in filepickerdelegate --- .../com/mr/flutter/plugin/filepicker/FilePickerDelegate.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java index 5e5eab17..0ae16d0d 100644 --- a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java +++ b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java @@ -85,6 +85,8 @@ public boolean onActivityResult(final int requestCode, final int resultCode, fin // Save file if (requestCode == SAVE_FILE_CODE) { if (resultCode == Activity.RESULT_OK) { + if (data == null) + return false; this.dispatchEventStatus(true); final Uri uri = data.getData(); if (uri != null) { From e090801731aa12d83e47629792115b3b594eac4c Mon Sep 17 00:00:00 2001 From: Lilian Cadiou Date: Sat, 19 Oct 2024 00:39:50 +0200 Subject: [PATCH 2/3] Fix after review - Added curly braces, changelog entry and new version number --- CHANGELOG.md | 5 +++++ .../com/mr/flutter/plugin/filepicker/FilePickerDelegate.java | 3 ++- pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d4d621d..67f3dee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 8.1.3 +### Android +- Fixes a null object reference error [#1604](https://github.com/miguelpruivo/flutter_file_picker/issues/1604) + + ## 8.1.2 ### Android - Fixes a cache deletion issue [#1505](https://github.com/miguelpruivo/flutter_file_picker/issues/1505) diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java index 0ae16d0d..0f0f6dd3 100644 --- a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java +++ b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java @@ -85,8 +85,9 @@ public boolean onActivityResult(final int requestCode, final int resultCode, fin // Save file if (requestCode == SAVE_FILE_CODE) { if (resultCode == Activity.RESULT_OK) { - if (data == null) + if (data == null) { return false; + } this.dispatchEventStatus(true); final Uri uri = data.getData(); if (uri != null) { diff --git a/pubspec.yaml b/pubspec.yaml index 155fc5a2..6624f78c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A package that allows you to use a native file explorer to pick sin homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker repository: https://github.com/miguelpruivo/flutter_file_picker issue_tracker: https://github.com/miguelpruivo/flutter_file_picker/issues -version: 8.1.2 +version: 8.1.3 dependencies: flutter: From 17e8637e5d578c9d2878cfbe1a1b022eff2d9511 Mon Sep 17 00:00:00 2001 From: Navaron Bracke Date: Sat, 19 Oct 2024 09:38:25 +0200 Subject: [PATCH 3/3] Remove blank line --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67f3dee3..3fad94a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ ### Android - Fixes a null object reference error [#1604](https://github.com/miguelpruivo/flutter_file_picker/issues/1604) - ## 8.1.2 ### Android - Fixes a cache deletion issue [#1505](https://github.com/miguelpruivo/flutter_file_picker/issues/1505)