shagiz / AsyncFilePicker

FIlepicker allows you to simplify photo and file picking process
Apache License 2.0
26 stars 2 forks source link

Crashed once in Lenovo Android 7 once. #5

Open dudhatparesh opened 5 years ago

dudhatparesh commented 5 years ago

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:318) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)

Caused by java.lang.NullPointerException: Attempt to invoke interface method 'void android.database.Cursor.close()' on a null object reference at org.shagi.filepicker.FilePickerUtilsKt.saveTempFileUri(FilePickerUtils.kt:89) at org.shagi.filepicker.SaveFileAsyncTask.saveFile(SaveFileAsyncTask.kt:81) at org.shagi.filepicker.SaveFileAsyncTask.saveToFile(SaveFileAsyncTask.kt:70) at org.shagi.filepicker.SaveFileAsyncTask.doInBackground(SaveFileAsyncTask.kt:46) at org.shagi.filepicker.SaveFileAsyncTask.doInBackground(SaveFileAsyncTask.kt:13) at android.os.AsyncTask$2.call(AsyncTask.java:304) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)

thegamer123 commented 4 years ago

add this to your onCreate , it will catch the exception

Thread.setDefaultUncaughtExceptionHandler { paramThread, paramThrowable -> //Catch your exception }