Merge "Prevent serialization after being destroyed"
diff --git a/core/java/android/webkit/ViewStateSerializer.java b/core/java/android/webkit/ViewStateSerializer.java
index 0fc76fa..5f91ed3 100644
--- a/core/java/android/webkit/ViewStateSerializer.java
+++ b/core/java/android/webkit/ViewStateSerializer.java
@@ -36,11 +36,15 @@
static boolean serializeViewState(OutputStream stream, WebView web)
throws IOException {
+ int baseLayer = web.getBaseLayer();
+ if (baseLayer == 0) {
+ return false;
+ }
DataOutputStream dos = new DataOutputStream(stream);
dos.writeInt(VERSION);
dos.writeInt(web.getContentWidth());
dos.writeInt(web.getContentHeight());
- return nativeSerializeViewState(web.getBaseLayer(), dos,
+ return nativeSerializeViewState(baseLayer, dos,
new byte[WORKING_STREAM_STORAGE]);
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 673db8c..2e7f923 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -4308,6 +4308,9 @@
}
int getBaseLayer() {
+ if (mNativeClass == 0) {
+ return 0;
+ }
return nativeGetBaseLayer();
}