cxfeng1 closed pull request #1572: [iOS] Protect animation module.
URL: https://github.com/apache/incubator-weex/pull/1572
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/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
index 9f8eb8942b..70a8feba25 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
@@ -152,10 +152,26 @@ - (void)transition:(NSString *)nodeRef args:(NSDictionary
*)args callback:(WXMod
_needLayout = NO;
_isAnimationedSuccess = YES;
WXPerformBlockOnComponentThread(^{
+ if (nodeRef == nil || ![nodeRef isKindOfClass:[NSString class]] ||
+ ![args isKindOfClass:[NSDictionary class]]) {
+ if (callback) {
+ NSDictionary *message = @{@"result":@"Fail",
+ @"message":@"Argument type error."};
+ callback(message, NO);
+ }
+ return;
+ }
+
NSArray *stringArray = [nodeRef componentsSeparatedByString:@"@"];
if ([stringArray count] == 0) {
+ if (callback) {
+ NSDictionary *message = @{@"result":@"Fail",
+ @"message":@"Node ref format
error."};
+ callback(message, NO);
+ }
return;
}
+
WXComponent *targetComponent = [self.weexInstance
componentForRef:stringArray[0]];
if (!targetComponent) {
if (callback) {
----------------------------------------------------------------
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