Wordpress-android: NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources$Theme android.content.Context.get...

Created on 25 May 2020  路  7Comments  路  Source: wordpress-mobile/WordPress-Android

Stacktrace points to https://github.com/wordpress-mobile/WordPress-Android/pull/11726.

Sentry Url: https://sentry.io/share/issue/863602a399094da387746f5947990973/
User Count: 16
Count: 38
First Release: org.wordpress.android-14.8
First Seen: 2020-05-20T05:45:21Z
Last Seen: 2020-05-25T05:32:03Z
24 Hours: 2
30 Days: 38

NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources$Theme android.content.Context.getTheme()' on a null object reference
     at com.google.android.material.resources.MaterialAttributes.resolve(MaterialAttributes.java:47)
     at com.google.android.material.dialog.MaterialAlertDialogBuilder.getMaterialAlertDialogThemeOverlay(MaterialAlertDialogBuilder.java:80)
     at com.google.android.material.dialog.MaterialAlertDialogBuilder.createMaterialAlertDialogThemedContext(MaterialAlertDialogBuilder.java:88)
     at com.google.android.material.dialog.MaterialAlertDialogBuilder.<init>(MaterialAlertDialogBuilder.java:110)
     at com.google.android.material.dialog.MaterialAlertDialogBuilder.<init>(MaterialAlertDialogBuilder.java:103)
     at org.wordpress.android.ui.comments.CommentDetailFragment.trashComment(CommentDetailFragment.java:1395)
     at org.wordpress.android.ui.comments.CommentDetailFragment.lambda$showMoreMenu$13$CommentDetailFragment(CommentDetailFragment.java:1348)
     at org.wordpress.android.ui.comments.-$$Lambda$CommentDetailFragment$cnjMY_ob6lu_9Esr72K4URgDe_I.onMenuItemClick(null:2)
     at androidx.appcompat.widget.PopupMenu$1.onMenuItemSelected(PopupMenu.java:113)
     at androidx.appcompat.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:840)
...
(13 additional frame(s) were not displayed)
Comments [Type] Crash

All 7 comments

This NPE started about 5 days ago and does seem potentially related to theCommentDetailFragment updates in #11726. @zwarm would you mind taking a look at this?

@bummytime Thanks for the heads up. I did move the code that is throwing the NPE to a separate function while implementing that PR. It's quite possible the NPE may have happened when the code was in its previous location too, but I have seen stranger things in Android. Unfortunately I can not recreate it. However I do have a preventative fix which should take care of it :), but I have no way to test it. :( Can you verify the target release? Should it be 15.0?

@zwarm v15.0 is perfecto! Thank you 馃檱

@zwarm This issue appeared in 15.0 again :(. Looking at the PR I think we both made a mistake :X - https://github.com/wordpress-mobile/WordPress-Android/pull/12035/files -> I think the if should use || not &&, wdyt?

@malinajirka @zwarm could we target v15.1 with 鈽濓笍 this fix?

@zwarm This issue appeared in 15.0 again :(. Looking at the PR I think we both made a mistake :X - https://github.com/wordpress-mobile/WordPress-Android/pull/12035/files -> I think the if should use || not &&, wdyt?

You are 100% correct - should be a !! not &&

Comparing a search for "issue.id:1676656641 version:15.0" and "issue.id:1676656641 version:15.1" in Sentry Discover, I don't see any events recorded in 15.1 (also see Version stats for the issue). Closing as fixed. Props @zwarm @malinajirka. 馃帀

Was this page helpful?
0 / 5 - 0 ratings