PickiT: Crash for some images

Describe the bug

After upgrading to PickIt 2.0.3 we implemented the method pickiT.isUnknownProvider(uri, Build.VERSION.SDK_INT). For some images, the program crash unexpectedly.

Describe the bug

We have this line where it crash:

if(pickiT.isUnknownProvider(uri, Build.VERSION.SDK_INT)  || !pickiT.wasLocalFileSelected(uri)) {
        result.error("IS_REMOTE_FILE", "The selected file is remote and is not implemented yet", null);
      }

And for this file content://com.android.providers.media.documents/document/image%3A66 the program crash.
But NOT for this content://com.android.providers.media.documents/document/image%3A65

Both are local (I can see them without internet connection). And if I disable the pickiT.isUnknownProvider(uri, Build.VERSION.SDK_INT) it still crashing. Neither downgrading to previous pickit version.

We also upgraded sdk from 30 to 31.

Log

E/AndroidRuntime(29424): FATAL EXCEPTION: AsyncTask #1
E/AndroidRuntime(29424): Process: net.altermundi.elrepoio, PID: 29424
E/AndroidRuntime(29424): java.lang.RuntimeException: An error occurred while executing doInBackground()
E/AndroidRuntime(29424): 	at android.os.AsyncTask$4.done(AsyncTask.java:399)
E/AndroidRuntime(29424): 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
E/AndroidRuntime(29424): 	at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
E/AndroidRuntime(29424): 	at java.util.concurrent.FutureTask.run(FutureTask.java:271)
E/AndroidRuntime(29424): 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
E/AndroidRuntime(29424): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(29424): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(29424): 	at java.lang.Thread.run(Thread.java:919)
E/AndroidRuntime(29424): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference
E/AndroidRuntime(29424): 	at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:71)
E/AndroidRuntime(29424): 	at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:19)
E/AndroidRuntime(29424): 	at android.os.AsyncTask$3.call(AsyncTask.java:378)
E/AndroidRuntime(29424): 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/AndroidRuntime(29424): 	... 4 more
I/Process (29424): Sending signal. PID: 29424 SIG: 9

PickiT version

2.0.3

Device information

  • Make/model

Redmi 9A MIUI 12.0.9

  • SDK version
 compileSdkVersion 31
minSdkVersion 16

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 37 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, thanks. As you said, using ClipData fixed the problem