Browser: Fix NPE when save tabs' view state
When browser try to saveViewState,one parameter of the method is
ContentValues.And the contentValues come from createSnapshotValues
method.But the value will be null if the main webview of this tab be
back to background.So NPE happens.
In the monkey test,the main webview of this tab may be back to
background.So we should check whether the values is null in
saveViewState method for safe.
CRs-Fixed: 543716
Change-Id: Ie61708968441c0f5041f45a0f5ada64161fe9c63
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index e3a0333..7bd502a 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -1878,6 +1878,8 @@
return false;
}
long size = savedFile.length();
+ if (values == null)
+ return false;
values.put(Snapshots.VIEWSTATE_PATH, path);
values.put(Snapshots.VIEWSTATE_SIZE, size);
return true;