Closed Bug 773177 Opened 13 years ago Closed 13 years ago

java.lang.NullPointerException: at org.mozilla.gecko.TabsTray$TabsAdapter.refreshTabsData(TabsTray.java)

Categories

(Firefox for Android Graveyard :: General, defect)

16 Branch
ARM
Android
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 16

People

(Reporter: scoobidiver, Assigned: Margaret)

References

Details

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

Crash Data

Attachments

(1 file, 1 obsolete file)

There are two crashes from two users in 16.0a1/20120711. The regression range is: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=02b26fb307b4&tochange=53860f11100c It's likely a regression from bug 757198. java.lang.NullPointerException at org.mozilla.gecko.TabsTray$TabsAdapter.refreshTabsData(TabsTray.java:196) at org.mozilla.gecko.TabsTray$TabsAdapter.access$200(TabsTray.java:144) at org.mozilla.gecko.TabsTray.show(TabsTray.java:113) at org.mozilla.gecko.TabsPanel.show(TabsPanel.java:148) at org.mozilla.gecko.BrowserApp.showTabs(BrowserApp.java:328) at org.mozilla.gecko.BrowserApp.showLocalTabs(BrowserApp.java:317) at org.mozilla.gecko.BrowserToolbar.toggleTabs(BrowserToolbar.java:347) at org.mozilla.gecko.BrowserToolbar.access$100(BrowserToolbar.java:51) at org.mozilla.gecko.BrowserToolbar$3.onClick(BrowserToolbar.java:151) at android.view.View.performClick(View.java:2585) at android.view.View$PerformClick.run(View.java:9299) at android.os.Handler.handleCallback(Handler.java:587) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3691) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670) 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.TabsTray%24TabsAdapter.refreshTabsData%28TabsTray.java%29
Assignee: nobody → margaret.leibovic
Attached patch patch (obsolete) — Splinter Review
There used to be a null check where we were doing this in the TabsAdapter constructor: https://hg.mozilla.org/mozilla-central/rev/90e6b6c68e63#l1.140 I omitted it because I didn't think it was necessary, but it looks like it is. I didn't think we could get into a state with 0 tabs, but it looks like we must be. Alternately, we could update Tabs.getTabsInOrder() (and Tabs.getTabs()) to just return an empty array instead of returning null: http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/Tabs.java#209 We're probably already relying on that and doing null checks, but returning null like that seems like a foot-gun.
Attachment #641455 - Flags: review?(mark.finkle)
Attached patch patchSplinter Review
Whoops, need to make sure we're still doing the other stuff in this method.
Attachment #641455 - Attachment is obsolete: true
Attachment #641455 - Flags: review?(mark.finkle)
Attachment #641456 - Flags: review?(mark.finkle)
Comment on attachment 641456 [details] [diff] [review] patch ># HG changeset patch ># User Margaret Leibovic <margaret.leibovic@gmail.com> ># Date 1342104101 25200 ># Node ID f356af3cb177a153db40afe354f6d6beb7b93f0b ># Parent 0c6f0add64b2e115d5f374396b0dd38a7472c367 >Bug 773177 - java.lang.NullPointerException: at org.mozilla.gecko.TabsTray$TabsAdapter.refreshTabsData(TabsTray.java) > >diff --git a/mobile/android/base/TabsTray.java b/mobile/android/base/TabsTray.java >--- a/mobile/android/base/TabsTray.java >+++ b/mobile/android/base/TabsTray.java >@@ -188,18 +188,21 @@ public class TabsTray extends LinearLayo > } > } > > private void refreshTabsData() { > // Store a different copy of the tabs, so that we don't have to worry about > // accidentally updating it on the wrong thread. > mTabs = new ArrayList<Tab>(); > ArrayList<Tab> tabs = Tabs.getInstance().getTabsInOrder(); >- for (Tab tab : tabs) { >- mTabs.add(tab); >+ >+ if (tabs != null) { >+ for (Tab tab : tabs) { >+ mTabs.add(tab); >+ } > } > > notifyDataSetChanged(); // Be sure to call this whenever mTabs changes. > updateSelectedPosition(); > } > > // Updates the selected position in the list so that it will be scrolled to the right place. > private void updateSelectedPosition() {
Attachment #641456 - Flags: review?(mark.finkle) → review+
Target Milestone: --- → Firefox 16
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
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: