Clicking any file or folder on OTG after the device has been removed caused Amaze file manager v 3.2.1 to crash

in #utopian-io7 years ago

Project Information

Expected Behavior

I expected that after I ejected my OTG flash drive, the location wouldn't be available on the file manager and even it's still available, clicking on it will have no effect.

Actual Behavior

The OTG directory doesn't close when the OTG flash drive was ejected, it looked like though the OTG flash drive was still connected because all the contents were still visible after the drive was removed and clicking any file or folder caused the app to crash.

Steps to Reproduce

  • plug in OTG flash drive
  • launch amaze file manager
  • swipe from left to right to reveal menus, shortcuts and options
  • select OTG and allow access
  • after OTG storage is open on the file manager, eject the drive either forcefully or using the eject button on notifications panel
  • the contents of the OTG flash drive is still open even after ejection and clicking any content on it will causes the app to crash.

Test Environment

  • Device: Tecno Camon CM
  • OS Version: Android 7.0
  • Software Version: v3.2.1

Logcat

FATAL EXCEPTION: main
Process: com.amaze.filemanager, PID: 29998
java.lang.NullPointerException: Attempt to invoke virtual method 'android.support.v4.provider.DocumentFile android.support.v4.provider.DocumentFile.findFile(java.lang.String)' on a null object reference
    at com.amaze.filemanager.utils.OTGUtil.getDocumentFile(OTGUtil.java:95)
    at com.amaze.filemanager.fragments.MainFragment.onListItemClicked(MainFragment.java:922)
    at com.amaze.filemanager.adapters.RecyclerAdapter$1.onClick(RecyclerAdapter.java:401)
    at android.view.View.performClick(View.java:6076)
    at android.view.View$PerformClick.run(View.java:23138)
    at android.os.Handler.handleCallback(Handler.java:836)
    at android.os.Handler.dispatchMessage(Handler.java:103)
    at android.os.Looper.loop(Looper.java:203)
    at android.app.ActivityThread.main(ActivityThread.java:6292)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1094)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)

Recording of the bug

Proof of Work Done

This is the link to my github account

Coin Marketplace

STEEM 0.21
TRX 0.26
JST 0.040
BTC 101296.09
ETH 3673.80
USDT 1.00
SBD 3.15