Crash on HTC Desire Android 5.1
koushikchoudhury0 opened this issue · comments
Stacktrace from Crashlytics:
Caused by java.lang.NullPointerException: Attempt to invoke interface method 'int android.database.Cursor.getColumnIndex(java.lang.String)' on a null object reference
at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:68)
at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:19)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
That's very strange. The error is pointing to:
This can only be caused if the Uri
that is passed to the above has a file scheme instead of a content scheme. But the DownloadAsyncTask
is only called on content scheme Uri
's.
What I can do to make sure this doesn't happen is to change the above to:
if (returnCursor != null && returnCursor.moveToFirst()){
if (mUri.getScheme() != null)
if (mUri.getScheme().equals("content")) {
int sizeIndex = returnCursor.getColumnIndex(OpenableColumns.SIZE);
size = (int) returnCursor.getLong(sizeIndex);
}else if (mUri.getScheme().equals("file")) {
File file = new File(mUri.getPath());
size = (int) file.length();
}
}
Can you please let me know what files you are letting your user pick? Also, please provide me with your Intent
you use for selecting a file.
Closing since I did not get any response.