OSDN Git Service

Check for null before accessing mPickerData.
authorPatrick Scott <phanna@android.com>
Tue, 28 Apr 2009 12:03:29 +0000 (08:03 -0400)
committerPatrick Scott <phanna@android.com>
Tue, 28 Apr 2009 12:03:29 +0000 (08:03 -0400)
It could be null when switching to a parent tab since the parent tab will be
restored before showing the tab picker. This clears mPickerData before building
the tab picker.

src/com/android/browser/TabControl.java

index 0e93453..581d144 100644 (file)
@@ -249,7 +249,10 @@ class TabControl {
          * @return The WebView's url or null.
          */
         public String getUrl() {
-            return mPickerData.mUrl;
+            if (mPickerData != null) {
+                return mPickerData.mUrl;
+            }
+            return null;
         }
 
         /**
@@ -260,7 +263,10 @@ class TabControl {
          * @return The WebView's title (or url) or null.
          */
         public String getTitle() {
-            return mPickerData.mTitle;
+            if (mPickerData != null) {
+                return mPickerData.mTitle;
+            }
+            return null;
         }
 
         /**