瀏覽代碼

fix: asyncUpload logic error

pu 4 年之前
父節點
當前提交
388f44580f
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7
    4
      android/src/main/java/com/reactlibrary/AliyunUploadManager.java

+ 7
- 4
android/src/main/java/com/reactlibrary/AliyunUploadManager.java 查看文件

@@ -148,10 +148,13 @@ public class AliyunUploadManager {
148 148
         try {
149 149
             String[] proj = {MediaStore.Images.Media.DATA};
150 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 158
         } catch (Exception e) {
156 159
             uploadFilePath = FileUtils.getFilePathFromURI(context.getCurrentActivity(), selectedVideoUri);
157 160
         } finally {