Skip to content

Commit

Permalink
[image_picker] fix error if pick image from yandex disk(dropbox) (flu…
Browse files Browse the repository at this point in the history
…tter#1265)

Certain cloud storage platform does not have data column. We return null when there is no data column and fetch the image from online source. 
fixed flutter/flutter#26940
fixed flutter/flutter#21547
  • Loading branch information
ivk1800 authored and Chris Yang committed Mar 12, 2019
1 parent 5afa9d5 commit 432f775
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.5.0+7
* Fix a crash when selecting images from yandex.disk and dropbox.

## 0.5.0+6

* Delete the original image if it was scaled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ private static String getDataColumn(
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
if (cursor != null && cursor.moveToFirst()) {
final int column_index = cursor.getColumnIndexOrThrow(column);
final int column_index = cursor.getColumnIndex(column);

//yandex.disk and dropbox do not have _data column
if (column_index == -1) {
return null;
}

return cursor.getString(column_index);
}
} finally {
Expand Down
2 changes: 1 addition & 1 deletion packages/image_picker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors:
- Flutter Team <[email protected]>
- Rhodes Davis Jr. <[email protected]>
homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker
version: 0.5.0+6
version: 0.5.0+7

flutter:
plugin:
Expand Down

0 comments on commit 432f775

Please sign in to comment.