From 3d202903a11f24af9832d18456a5ad2ef9d66de9 Mon Sep 17 00:00:00 2001 From: wwwcg Date: Thu, 6 Jun 2024 17:18:09 +0800 Subject: [PATCH] fix(ios): resolve exception where touchView may be nil --- ios/sdk/base/HippyTouchHandler.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ios/sdk/base/HippyTouchHandler.m b/ios/sdk/base/HippyTouchHandler.m index 2d3a32a42e3..c1c49c68b31 100644 --- a/ios/sdk/base/HippyTouchHandler.m +++ b/ios/sdk/base/HippyTouchHandler.m @@ -117,7 +117,9 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UIView *touchView = [touch view]; CGPoint locationPoint = [touch locationInView:touchView]; touchView = touchView?:[self.view.window hitTest:locationPoint withEvent:event]; - [_touchBeganViews addObject:touchView]; + if (touchView) { + [_touchBeganViews addObject:touchView]; + } NSDictionary *result = [self responseViewForAction:@[@"onPressIn", @"onTouchDown", @"onClick", @"onLongClick"] inView:touchView atPoint:locationPoint];