am 73972695: Merge change 4925 into donut

Merge commit '73972695c844b25370ad738bb76e8eb2e9cd81e6'

* commit '73972695c844b25370ad738bb76e8eb2e9cd81e6':
  Fix 2 NPEs in the Browser.
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index d1d8d15..ef484b0 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -2187,10 +2187,12 @@
         final Animation.AnimationListener l =
                 new Animation.AnimationListener() {
                     public void onAnimationStart(Animation a) {
-                        mTabOverview.requestFocus();
-                        // Clear the listener so we don't trigger a tab
-                        // selection.
-                        mTabOverview.setListener(null);
+                        if (mTabOverview != null) {
+                            mTabOverview.requestFocus();
+                            // Clear the listener so we don't trigger a tab
+                            // selection.
+                            mTabOverview.setListener(null);
+                        }
                     }
                     public void onAnimationRepeat(Animation a) {}
                     public void onAnimationEnd(Animation a) {
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index f66df69..bdb57fa 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -712,8 +712,9 @@
             t = mTabQueue.get(i++);
         } while (i < queueSize && t != null && t.mMainView == null);
 
-        // Don't do anything if the last remaining tab is the current one.
-        if (t == getCurrentTab()) {
+        // Don't do anything if the last remaining tab is the current one or if
+        // the last tab has been freed already.
+        if (t == getCurrentTab() || t.mMainView == null) {
             return null;
         }