wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.99k stars 1.33k forks source link

Crash in ToastUtils showToast #8590

Closed loremattei closed 5 years ago

loremattei commented 6 years ago
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getString(int)' on a null object reference
       at org.wordpress.android.util.ToastUtils.showToast(ToastUtils.java:25)
       at org.wordpress.android.ui.main.MeFragment$8.onLoadFailed(MeFragment.java:331)
       at org.wordpress.android.util.image.ImageManager$attachRequestListener$1.onLoadFailed(ImageManager.kt:277)
       at com.bumptech.glide.request.SingleRequest.onLoadFailed(SingleRequest.java:613)
       at com.bumptech.glide.request.SingleRequest.onLoadFailed(SingleRequest.java:593)
       at com.bumptech.glide.load.engine.EngineJob.handleExceptionOnMainThread(EngineJob.java:293)
       at com.bumptech.glide.load.engine.EngineJob$MainThreadCallback.handleMessage(EngineJob.java:327)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5443)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

5ae5c2ea638393737aa7e57e-fabric

rachelmcr commented 5 years ago

Adding a high priority label as this is currently our most frequent crash.

rachelmcr commented 5 years ago

I just experienced this crash while testing WPAndroid alpha-144. It happened to me with the following steps:

  1. Start logged in to a self-hosted (non-Jetpack) site in the app.
  2. Log in to WordPress.com.
  3. Ensure that you are fully logged in, and select a WordPress.com site on the My Sites tab.
  4. On the Me tab, log out of WordPress.com. Note that the screen doesn't fully refresh (you see all the Me sections that you would see when logged in to WordPress.com, but without any Gravatar or username).
  5. Select the My Sites tab.
  6. Note that you see your WordPress.com site there. Select "Switch site."
  7. In the site picker, tap the back button. Result: Crash.

I reproduced this crash twice. I then removed the self-hosted site from the app and re-added it, and after that point I couldn't reproduce it. (Now when I log out of WordPress.com the Me tab refreshes as expected and no crash occurs.)

I have saved my full logcat logs and a screencast of the steps above; ping me if those would be helpful to look over while investigating this.

jtreanor commented 5 years ago

Confirmed this is fixed in 11.6.