Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] Protect animation module. (#1572)
Browse files Browse the repository at this point in the history
  • Loading branch information
wqyfavor authored and cxfeng1 committed Sep 25, 2018
1 parent cd89a4d commit 5310826
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5310826

Please sign in to comment.