dnet / adsdroid

Unofficial AllDataSheet Android application
https://techblog.vsza.hu/posts/Unofficial_Android_app_for_alldatasheet.com.html
MIT License
29 stars 11 forks source link

App triggers NullPointerExpcetions and crashes #30

Open Marukohe opened 1 year ago

Marukohe commented 1 year ago

App will crash due to some concurrency bugs.

Trace

// CRASH: hu.vsza.adsdroid (pid 6126)
// Short Msg: java.lang.NullPointerException
// Long Msg: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ProgressDialog.dismiss()' on a null object reference
// Build Label: google/sdk_gphone_x86_arm/generic_x86_arm:9/PSR1.180720.122/6736742:userdebug/dev-keys
// Build Changelist: 6736742
// Build Time: 1596587219000
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ProgressDialog.dismiss()' on a null object reference
    at hu.vsza.adsdroid.c.a(Unknown Source:8)
    at hu.vsza.adsdroid.c.onPostExecute(Unknown Source:2)
    at android.os.AsyncTask.finish(AsyncTask.java:695)
    at android.os.AsyncTask.access$600(AsyncTask.java:180)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Reason

SearchPanel class will post some AsyncTasks. If the first task invoke its onPostExecute() method, the field mProgressDialog will be set to null. At the same time, the second task uses this field, and NPE is triggered.