YorkShen closed pull request #1292: [android][WEEX-474] when the app's
WXInstance destroy, but Weex page call toast Toast ,crash
URL: https://github.com/apache/incubator-weex/pull/1292
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/android/sdk/src/main/java/com/taobao/weex/ui/module/WXModalUIModule.java
b/android/sdk/src/main/java/com/taobao/weex/ui/module/WXModalUIModule.java
index 76ba718671..3449359e3a 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/module/WXModalUIModule.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/module/WXModalUIModule.java
@@ -61,7 +61,9 @@
@JSMethod(uiThread = true)
public void toast(JSONObject jsObj) {
-
+ if(mWXSDKInstance.getContext() == null){
+ return;
+ }
String message = "";
int duration = Toast.LENGTH_SHORT;
if (jsObj != null) {
diff --git
a/android/sdk/src/main/java/com/taobao/weex/ui/view/WXCircleViewPager.java
b/android/sdk/src/main/java/com/taobao/weex/ui/view/WXCircleViewPager.java
index 616c16df7c..f44f59a4e3 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/WXCircleViewPager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/WXCircleViewPager.java
@@ -233,11 +233,15 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
}
break;
}
- boolean result = super.dispatchTouchEvent(ev);
- if (wxGesture != null) {
- result |= wxGesture.onTouch(this, ev);
+ try{
+ boolean result = super.dispatchTouchEvent(ev);
+ if (wxGesture != null) {
+ result |= wxGesture.onTouch(this, ev);
+ }
+ return result;
+ }catch (Exception e){
+ return false;
}
- return result;
}
public void destory() {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services