Closed Bug 849254 Opened 11 years ago Closed 11 years ago

java.lang.NullPointerException: at org.mozilla.gecko.BrowserApp.setToolbarHeight(BrowserApp.java)

Categories

(Firefox for Android Graveyard :: General, defect)

22 Branch
ARM
Android
defect
Not set
critical

Tracking

(firefox21 unaffected, firefox22 fixed)

RESOLVED FIXED
Firefox 22
Tracking Status
firefox21 --- unaffected
firefox22 --- fixed

People

(Reporter: scoobidiver, Assigned: cwiiis)

References

Details

(Keywords: crash, regression, Whiteboard: [native-crash])

Crash Data

Attachments

(1 file, 1 obsolete file)

It has been hit several times at startup in 22.0a1/20130308 by a single user. Here is a crash report: bp-9876f544-35c0-4a7f-8eb2-eb1a82130308.
Based on the stack trace, it's a regression from bug 716403 whose the patch landed in that build.

java.lang.NullPointerException
	at org.mozilla.gecko.BrowserApp.setToolbarHeight(BrowserApp.java:488)
	at org.mozilla.gecko.BrowserToolbarLayout.refreshMargins(BrowserToolbarLayout.java:62)
	at org.mozilla.gecko.BrowserApp.showAboutHome(BrowserApp.java:965)
	at org.mozilla.gecko.BrowserApp.onTabChanged(BrowserApp.java:117)
	at org.mozilla.gecko.Tabs$5.run(Tabs.java:450)
	at android.app.Activity.runOnUiThread(Activity.java:4185)
	at org.mozilla.gecko.Tabs.notifyListeners(Tabs.java:440)
	at org.mozilla.gecko.Tabs.notifyListeners(Tabs.java:436)
	at org.mozilla.gecko.Tabs$3.run(Tabs.java:165)
	at android.os.Handler.handleCallback(Handler.java:605)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4507)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
	at dalvik.system.NativeStart.main(Native Method)

More reports at:
https://crash-stats.mozilla.com/report/list?signature=java.lang.NullPointerException%3A+at+org.mozilla.gecko.BrowserApp.setToolbarHeight%28BrowserApp.java%29
Hit by a second user.
Whiteboard: [native-crash][startupcrash] → [native-crash]
Assignee: nobody → chrislord.net
Status: NEW → ASSIGNED
Attachment #723428 - Flags: review?(bugmail.mozilla)
Comment on attachment 723428 [details] [diff] [review]
Fix NPE when setting toolbar height

Review of attachment 723428 [details] [diff] [review]:
-----------------------------------------------------------------

I think moving the call to refreshMargins() into the AboutHomeRunnable should be sufficient to fix this bug; the rest of it is not needed and makes reading the code more confusing.

::: mobile/android/base/BrowserApp.java
@@ +486,5 @@
>                  // about:home widget directly - this is to avoid resizing the
>                  // LayerView, which can cause visible artifacts.
> +                if (mAboutHomeContent != null) {
> +                    mAboutHomeContent.setPadding(0, aVisibleHeight, 0, 0);
> +                }

This should be unnecessary after moving the call to refreshMargins() into the AboutHomeRunnable.

@@ +491,4 @@
>              } else {
> +                if (mToolbarSpacer != null) {
> +                    mToolbarSpacer.setPadding(0, aVisibleHeight, 0, 0);
> +                }

mToolbarSpacer gets initialized in onCreate, so it should never be null here

@@ +496,5 @@
>              aHeight = aVisibleHeight = 0;
>          } else {
> +            if (mToolbarSpacer != null) {
> +                mToolbarSpacer.setPadding(0, 0, 0, 0);
> +            }

Ditto
Attachment #723428 - Flags: review?(bugmail.mozilla) → review-
Done as suggested. You're right, I was just being extra-safe.
Attachment #723428 - Attachment is obsolete: true
Attachment #723463 - Flags: review?(bugmail.mozilla)
Attachment #723463 - Flags: review?(bugmail.mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/cecc73dc627a
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: