From 3f51118fc86dbd58e76375357576e721e142d1fb Mon Sep 17 00:00:00 2001 From: Brian Nicholson Date: Mon, 22 Oct 2012 12:42:14 -0700 Subject: [PATCH] Bug 799977 - Don't set parentId in loadUrlInTab() if no tabs exist. r=mfinkle --- mobile/android/base/Tabs.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/Tabs.java b/mobile/android/base/Tabs.java index 7f80773f97a..f053b912213 100644 --- a/mobile/android/base/Tabs.java +++ b/mobile/android/base/Tabs.java @@ -532,7 +532,16 @@ public class Tabs implements GeckoEventListener { } } - loadUrl(url, null, getSelectedTab().getId(), LOADURL_NEW_TAB); + // getSelectedTab() can return null if no tab has been created yet + // (i.e., we're restoring a session after a crash). In these cases, + // don't mark any tabs as a parent. + int parentId = -1; + Tab selectedTab = getSelectedTab(); + if (selectedTab != null) { + parentId = selectedTab.getId(); + } + + loadUrl(url, null, parentId, LOADURL_NEW_TAB); } /**