HBiSoft / PickiT

An Android library that returns real paths from Uri's

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DownloadAsyncTask divide by zero

VahanLab opened this issue Β· comments

Hi,
First, thank you for your awesome library, it really helps me πŸ™‚
I noticed an issue when trying to get a google doc / google sheet file from Google Drive. Drive gives the file as a PDF, however, the DownloadAsyncTask crash because size is somehow equal to zero

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
    Process: com.smashco.smash, PID: 3924
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:354)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.ArithmeticException: divide by zero
        at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:98)
        at com.hbisoft.pickit.DownloadAsyncTask.doInBackground(DownloadAsyncTask.java:19)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 

This should be fixed in my latest commit. Can you please confirm?

Yeah this happened to me on 0.1.6 as well, I've updated to 0.1.7

@droidluv I've updated to 0.1.8, please test and let me know. I will be closing this issue until I get feedback.

I don't think its crashing anymore, can't seem to reproduce it