Skip to content

Commit cda4183

Browse files
authored
Merge pull request kraffslol#31 from BlakeWilliams/bmw-paypal-fix
Handle nil tokenizedPayPalAccount
2 parents df3255b + 04ebd59 commit cda4183

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ios/RCTBraintree/RCTBraintree.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ - (instancetype)init
102102
payPalDriver.viewControllerPresentingDelegate = self;
103103

104104
[payPalDriver authorizeAccountWithCompletion:^(BTPayPalAccountNonce *tokenizedPayPalAccount, NSError *error) {
105-
NSArray *args = @[];
106-
if ( error == nil ) {
107-
args = @[[NSNull null], tokenizedPayPalAccount.nonce, tokenizedPayPalAccount.email, tokenizedPayPalAccount.firstName, tokenizedPayPalAccount.lastName, tokenizedPayPalAccount.phone];
108-
} else {
105+
NSArray *args = @[[NSNull null]];
106+
if ( error == nil && tokenizedPayPalAccount != nil ) {
107+
args = @[[NSNull null], tokenizedPayPalAccount.nonce, tokenizedPayPalAccount.email, tokenizedPayPalAccount.firstName, tokenizedPayPalAccount.lastName, tokenizedPayPalAccount.phone];
108+
} else if ( error != nil ) {
109109
args = @[error.description, [NSNull null]];
110110
}
111+
111112
callback(args);
112113
}];
113114
});

0 commit comments

Comments
 (0)