This is an automated email from the ASF dual-hosted git repository.

moshen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new 057cc79  [iOS] fix un catched exception when nan value passed from 
front end
     new d90963e  Merge pull request #3086 from 
sunshl/Jiakui/bugfix_191217_crashfix
057cc79 is described below

commit 057cc79a5d53ed54a22ca1236c374c1442ecd75c
Author: huanglei.hl <[email protected]>
AuthorDate: Tue Dec 17 12:05:57 2019 +0800

    [iOS] fix un catched exception when nan value passed from front end
---
 ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm 
b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
index 6fa35be..0a86a77 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
@@ -70,6 +70,7 @@ static NSThread *WXComponentThread;
 
 #define WXAssertComponentExist(component)  WXAssert(component, @"component not 
exists")
 #define MAX_DROP_FRAME_FOR_BATCH   200
+#define SYNC_UI_EXCEPTION_LOG_INTERVAL 1000
 
 @interface WXComponentManager () <WXDisplayLinkClient>
 @end
@@ -1146,7 +1147,15 @@ static NSThread *WXComponentThread;
         if (blocks.count) {
             dispatch_async(dispatch_get_main_queue(), ^{
                 for(dispatch_block_t block in blocks) {
-                    block();
+                    @try {
+                        block();
+                    } @catch (NSException *exception) {
+                        static NSInteger sCatchCount = 0;
+                        if (++sCatchCount % SYNC_UI_EXCEPTION_LOG_INTERVAL == 
1) {
+                            // log for the first time and control interval
+                            WXLogError(@"SyncUI Exception:%@", exception);
+                        }
+                    }
                 }
             });
         }

Reply via email to