AmazeFileManager
AmazeFileManager copied to clipboard
NPE on `HybridFile#isDirectory`
Issue explanation (write below this line)
Hope this helps & is in the correct place
Exception
- App Name: Amaze File Manager
- Package: com.amaze.filemanager
- Version: 3.7.2
- User Action: UI Error
- Request: Application crash
- OS: Linux Android 11 - 30
- Device: a03su
- Model: SM-S134DL
- Product: a03sutfn
Crash log
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:415)
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:305)
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:923)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.documentfile.provider.DocumentFile.isDirectory()' on a null object reference
at com.amaze.filemanager.filesystem.HybridFile.isDirectory(HybridFile.java:579)
at com.amaze.filemanager.filesystem.files.FileUtils.getBaseFileSize(FileUtils.java:206)
at com.amaze.filemanager.filesystem.files.FileUtils.getTotalBytes(FileUtils.java:200)
at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground.doInBackground(CopyService.java:251)
at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground.doInBackground(CopyService.java:234)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 4 more
Reporter: via80hd
I can reliably reproduce this by attempting to copy a file from one application's data directory directly into a different application's data directory.
To reproduce:
- Give AmazeFileManager permission to access both
/storage/emulated/0/Android/com.dev.app1/and/storage/emulated/0/Android/com.dev.app2/ - Attempt to copy
/storage/emulated/0/Android/com.dev.app1/some_filedirectly into/storage/emulated/0/Android/com.dev.app2/.
Note that copying the file to some other non-app directory first, then copying from there to the app2 directory works fine. It seems like just app directory -> app directory is the issue.
@TranceLove will this be fixed with #4047?
@VishnuSanal We may add a band-it solution to fix the NPE, but on the other hand I expect more refactorings to OTGUtils to support multiple URI roots in order for copying between different Android/data directories to work 🥲