Closed Bug 1426864 Opened 2 years ago Closed 2 years ago

Crash in java.lang.NullPointerException: Attempt to invoke virtual method ''boolean org.mozilla.gecko.Tab.isPrivate()'' on a null object reference at org.mozilla.gecko.BrowserApp.onSearch(BrowserApp.java)

Categories

(Firefox for Android :: Awesomescreen, defect, critical)

All
Android
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Firefox 59
Tracking Status
firefox57 --- wontfix
firefox58 --- fixed
firefox59 --- fixed

People

(Reporter: JanH, Assigned: JanH)

References

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

This bug was filed from the Socorro interface and is
report bp-aa5d7a89-1c9a-47a2-8e72-1125a0171222.
=============================================================

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.mozilla.gecko.Tab.isPrivate()' on a null object reference
	at org.mozilla.gecko.BrowserApp.onSearch(BrowserApp.java:4309)
	at org.mozilla.gecko.home.SearchEngineRow$1.onClick(SearchEngineRow.java:118)
	at android.view.View.performClick(View.java:5646)
	at android.view.View$PerformClick.run(View.java:22459)
	at android.os.Handler.handleCallback(Handler.java:761)
	at android.os.Handler.dispatchMessage(Handler.java:98)
	at android.os.Looper.loop(Looper.java:156)
	at android.app.ActivityThread.main(ActivityThread.java:6523)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

=============================================================
Attachment #8938653 - Flags: review?(cnevinchen)
Comment on attachment 8938653 [details]
Bug 1426864 - Determine private mode via browser toolbar, 2nd edition.

https://reviewboard.mozilla.org/r/209262/#review215098

Do you think we should add @CheckResult on Tabs.class's getSelectedTab() method?
Attachment #8938653 - Flags: review?(cnevinchen) → review+
Comment on attachment 8938653 [details]
Bug 1426864 - Determine private mode via browser toolbar, 2nd edition.

https://reviewboard.mozilla.org/r/209262/#review215098

I can add it for completeness (and probably should update the javadoc comment a little while I'm at it), although not using the return value of that method (which I think is all that @CheckResult enforces) isn't the problem in this case. The issue at hand is the selected tab possibly being null, which we've already got the @Nullable annotation for.
Comment on attachment 8938653 [details]
Bug 1426864 - Determine private mode via browser toolbar, 2nd edition.

https://reviewboard.mozilla.org/r/209262/#review215098

Adding these things in bug 1426613, since that'll be the parent changeset of this bug.
Pushed by mozilla@buttercookie.de:
https://hg.mozilla.org/integration/autoland/rev/36b69642c15c
Determine private mode via browser toolbar, 2nd edition. r=nechen
https://hg.mozilla.org/mozilla-central/rev/36b69642c15c
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
Comment on attachment 8938653 [details]
Bug 1426864 - Determine private mode via browser toolbar, 2nd edition.

Approval Request Comment
[Feature/Bug causing the regression]: Awesomescreen search
[User impact if declined]: Firefox could crash if a search is launched while no tab exists yet.
[Is this code covered by automated tests?]: No.
[Has the fix been verified in Nightly?]: No.
[Needs manual test from QE? If yes, steps to reproduce]: No.
[List of other uplifts needed for the feature/fix]: Bug 1426613 and bug 1352133 are very similar crashes that might also happen along the same code path, i.e. if only one bug is fixed you might still crash because of one of the other bugs.
[Is the change risky?]: No.
[Why is the change risky/not risky?]: Instead of looking at the currently selected tab (which might not exist yet early during startup) we look at the browser toolbar (which is guaranteed to exist if the awesomescreen UI has loaded) to determine whether we're in private browsing or not.
[String changes made/needed]: none
Attachment #8938653 - Flags: approval-mozilla-beta?
Comment on attachment 8938653 [details]
Bug 1426864 - Determine private mode via browser toolbar, 2nd edition.

Fix a crash related to Awesomescreen. Beta58+.
Attachment #8938653 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.