Skip to content

Commit

Permalink
Merge pull request #37 from BlakeWilliams/bmw-phone-fix
Browse files Browse the repository at this point in the history
Check if phone is nil before adding it to args
  • Loading branch information
kraffslol authored Apr 1, 2017
2 parents 90789f7 + 6f7c3e3 commit 11fe781
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ios/RCTBraintree/RCTBraintree.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ - (instancetype)init
payPalDriver.viewControllerPresentingDelegate = self;

[payPalDriver authorizeAccountWithCompletion:^(BTPayPalAccountNonce *tokenizedPayPalAccount, NSError *error) {
NSArray *args = @[[NSNull null]];
NSMutableArray *args = @[[NSNull null]];
if ( error == nil && tokenizedPayPalAccount != nil ) {
args = @[[NSNull null], tokenizedPayPalAccount.nonce, tokenizedPayPalAccount.email, tokenizedPayPalAccount.firstName, tokenizedPayPalAccount.lastName, tokenizedPayPalAccount.phone];
args = [@[[NSNull null], tokenizedPayPalAccount.nonce, tokenizedPayPalAccount.email, tokenizedPayPalAccount.firstName, tokenizedPayPalAccount.lastName] mutableCopy];

if (tokenizedPayPalAccount.phone != nil) {
[args addObject:tokenizedPayPalAccount.phone];
}
} else if ( error != nil ) {
args = @[error.description, [NSNull null]];
}
Expand Down

0 comments on commit 11fe781

Please sign in to comment.