Browse Source

fix: asyncUpload logic error

pu 4 years ago
parent
commit
388f44580f
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      android/src/main/java/com/reactlibrary/AliyunUploadManager.java

+ 7
- 4
android/src/main/java/com/reactlibrary/AliyunUploadManager.java View File

148
         try {
148
         try {
149
             String[] proj = {MediaStore.Images.Media.DATA};
149
             String[] proj = {MediaStore.Images.Media.DATA};
150
             cursor = context.getCurrentActivity().getContentResolver().query(selectedVideoUri, proj, null, null, null);
150
             cursor = context.getCurrentActivity().getContentResolver().query(selectedVideoUri, proj, null, null, null);
151
-            if (cursor == null) uploadFilePath = selectedVideoUri.getPath();
152
-            int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
153
-            cursor.moveToFirst();
154
-            uploadFilePath = cursor.getString(column_index);
151
+            if (cursor == null) {
152
+                uploadFilePath = selectedVideoUri.getPath();
153
+            } else {
154
+                int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
155
+                cursor.moveToFirst();
156
+                uploadFilePath = cursor.getString(column_index);
157
+            }
155
         } catch (Exception e) {
158
         } catch (Exception e) {
156
             uploadFilePath = FileUtils.getFilePathFromURI(context.getCurrentActivity(), selectedVideoUri);
159
             uploadFilePath = FileUtils.getFilePathFromURI(context.getCurrentActivity(), selectedVideoUri);
157
         } finally {
160
         } finally {