mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32:51 +08:00
CB-6936: Merge pull request #304 from uareurapid/master
CB-6936: fix crash when calling methods on a destroyed webview
This commit is contained in:
commit
dddb2837dd
@ -110,8 +110,12 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
|||||||
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
|
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
|
||||||
@Override
|
@Override
|
||||||
public void setNetworkAvailable(boolean value) {
|
public void setNetworkAvailable(boolean value) {
|
||||||
|
//sometimes this can be called after calling webview.destroy() on destroy()
|
||||||
|
//thus resulting in a NullPointerException
|
||||||
|
if(webView!=null) {
|
||||||
webView.setNetworkAvailable(value);
|
webView.setNetworkAvailable(value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void runOnUiThread(Runnable r) {
|
public void runOnUiThread(Runnable r) {
|
||||||
SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
|
SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
|
||||||
|
Loading…
Reference in New Issue
Block a user