From 2e47c111a61c00ab7fdd4bad972a5f7259efea32 Mon Sep 17 00:00:00 2001 From: wwwcg Date: Sat, 12 Oct 2024 14:46:36 +0800 Subject: [PATCH] chore(ios): add Invalid prop keyPath check --- ios/sdk/base/HippyComponentData.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ios/sdk/base/HippyComponentData.mm b/ios/sdk/base/HippyComponentData.mm index b111860fcd5..a67c7f0e4a3 100644 --- a/ios/sdk/base/HippyComponentData.mm +++ b/ios/sdk/base/HippyComponentData.mm @@ -195,6 +195,7 @@ - (HippyPropBlock)propBlockForKey:(NSString *)name inDictionary:(NSMutableDictio NSArray *parts = [keyPath componentsSeparatedByString:@"."]; if (parts) { key = parts.lastObject; + HippyAssert(key, @"Invalid KeyPath, please check your prop define!"); parts = [parts subarrayWithRange:(NSRange) { 0, parts.count - 1 }]; } @@ -242,7 +243,7 @@ - (HippyPropBlock)propBlockForKey:(NSString *)name inDictionary:(NSMutableDictio [weakManager.bridge.eventDispatcher dispatchEvent:@"EventDispatcher" methodName:@"receiveNativeGesture" args:params]; } else { [params setValue:body ?: @{} forKey:@"extra"]; - [params setObject:key forKey:@"eventName"]; + [params setObject:key ?: @"" forKey:@"eventName"]; [weakManager.bridge.eventDispatcher dispatchEvent:@"EventDispatcher" methodName:@"receiveUIComponentEvent" args:params]; }