Closed Bug 1401871 Opened 7 years ago Closed 7 years ago

Crash in java.lang.NullPointerException: Attempt to invoke interface method ''android.view.MenuItem android.view.MenuItem.setVisible(boolean)'' on a null object reference at org.mozilla.gecko.home.HomeFragment.onCreateContextMenu(HomeFragment.java)

Categories

(Firefox for Android Graveyard :: General, defect)

Unspecified
Android
defect
Not set
critical

Tracking

(firefox55 wontfix, firefox56 wontfix, firefox57 verified, firefox58 fixed)

VERIFIED FIXED
Firefox 58
Tracking Status
firefox55 --- wontfix
firefox56 --- wontfix
firefox57 --- verified
firefox58 --- fixed

People

(Reporter: kanru, Assigned: jwu)

References

Details

(Keywords: crash, regression, Whiteboard: [FNC][SPT58.1][INT])

Crash Data

Attachments

(1 file)

This bug was filed from the Socorro interface and is 
report bp-2459e70c-a005-45da-9587-3270f0170918.
=============================================================

Looks like a regression from bug 1329131

java.lang.NullPointerException: Attempt to invoke interface method 'android.view.MenuItem android.view.MenuItem.setVisible(boolean)' on a null object reference
	at org.mozilla.gecko.home.HomeFragment.onCreateContextMenu(HomeFragment.java:211)
	at android.view.View.createContextMenu(View.java:12533)
	at com.android.internal.view.menu.ContextMenuBuilder.showPopup(ContextMenuBuilder.java:100)
	at com.android.internal.policy.DecorView.showContextMenuForChildInternal(DecorView.java:822)
	at com.android.internal.policy.DecorView.showContextMenuForChild(DecorView.java:799)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:879)
	at android.widget.AbsListView.performLongPress(AbsListView.java:3250)
	at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:3161)
	at android.os.Handler.handleCallback(Handler.java:789)
	at android.os.Handler.dispatchMessage(Handler.java:98)
	at android.os.Looper.loop(Looper.java:164)
	at android.app.ActivityThread.main(ActivityThread.java:6541)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Flags: needinfo?(topwu.tw)
Assignee: nobody → topwu.tw
Flags: needinfo?(topwu.tw)
Comment on attachment 8912134 [details]
Bug 1401871 - Check if menu item(home_add_to_launcher) exists or not before accessing it.

https://reviewboard.mozilla.org/r/183510/#review188800
Attachment #8912134 - Flags: review?(cnevinchen) → review+
Pushed by nechen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6282e18a63f6
Check if menu item(home_add_to_launcher) exists or not before accessing it. r=nechen
https://hg.mozilla.org/mozilla-central/rev/6282e18a63f6
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 58
Does this need a Beta approval request?
Flags: needinfo?(topwu.tw)
Yes, we should uplift this to beta, but I just found a better solution that would make the code logic more clear. I would create a follow-up bug and file a patch soon.
Flags: needinfo?(topwu.tw)
Depends on: 1403437
Hi Ryan,

Do we have to back out this patch to make the change in bug 1403437 can successfully be merged to beta without conflict?
Flags: needinfo?(ryanvm)
I don't see any reason why a patch from bug 1403437 would interfere with this one being uplifted to Beta. Sounds like it might be worth asking for uplift on that one too, though.
Flags: needinfo?(ryanvm)
Comment on attachment 8912134 [details]
Bug 1401871 - Check if menu item(home_add_to_launcher) exists or not before accessing it.

Approval Request Comment
[Feature/Bug causing the regression]:
A crash on new version (Android O)

[User impact if declined]:
App crash on Android O after launching.

[Is this code covered by automated tests?]:
No

[Has the fix been verified in Nightly?]:
Not yet

[Needs manual test from QE? If yes, steps to reproduce]: 
Yes, here is the STR:
1. Launch Fennec on Android O,
2. Tap 3-dot menu button on top-right,
3. Tap 'Page' option button,
4. Make sure there is no 'Add to Home Screen' option, and app doesn't crash

[List of other uplifts needed for the feature/fix]:
None

[Is the change risky?]:
No

[Why is the change risky/not risky?]:
This patch only adds a null check to prevent NullPointerException.

[String changes made/needed]:
None
Attachment #8912134 - Flags: approval-mozilla-beta?
Comment on attachment 8912134 [details]
Bug 1401871 - Check if menu item(home_add_to_launcher) exists or not before accessing it.

Fix a crash, taking it.
Should be in 57b4
Attachment #8912134 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Verified as fixed on Beta 57.0b4.
Device: Nexus 6P (Android 8.0)
Status: RESOLVED → VERIFIED
Whiteboard: [FNC][SPT58.1][INT]
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.