Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent calling requestsDismissalOfViewController #199

Merged
merged 1 commit into from
Nov 30, 2015

Conversation

Reflejo
Copy link
Contributor

@Reflejo Reflejo commented Nov 25, 2015

This fix prevents calling requestsDismissalOfViewController when there is nothing to dismiss. The same way requestsPresentationOfViewController is not being called when there is nothing to present.

Before this, the library was crashing on runtime when using swift and iOS < 9 as this is passing nil to a function signature that is marked as non_null.

This fix prevents calling requestsDismissalOfViewController when there
is nothing to dismiss. The same way
`requestsPresentationOfViewController` is not being called.

This is also crashing on runtime on swift as this is passing `nil` to a
function signature that is mark as `non_null`.
@burnto
Copy link
Contributor

burnto commented Nov 25, 2015

Cool, thanks for this.

I wonder if we could reasonably just move this check to the inform method. @skunkworks and @intelliot can make the call.

@Reflejo
Copy link
Contributor Author

Reflejo commented Nov 26, 2015

@burnto That was my first approach. Wasn't sure what to do with

else {
        [[BTLogger sharedLogger] critical:@"Unable to dismiss View Controller to end PayPal flow. BTPayPalDriver needs a viewControllerPresentingDelegate<BTViewControllerPresentingDelegate> to be set."];
}

but yeah, seems safer to do it there

@intelliot
Copy link
Contributor

This PR looks good to me. In the requestsPresentationOfViewController case, informDelegatePresentingViewControllerRequestPresent does not get called when there won't be a view controller to present. This makes informDelegatePresentingViewControllerNeedsDismissal work the same way.

Thanks, @Reflejo !

intelliot added a commit that referenced this pull request Nov 30, 2015
Prevent calling requestsDismissalOfViewController
@intelliot intelliot merged commit 3ec051e into braintree:master Nov 30, 2015
@Reflejo
Copy link
Contributor Author

Reflejo commented Dec 2, 2015

Any chance to bump the podspec version with this fix? It was pretty bad on non ios9

@Reflejo
Copy link
Contributor Author

Reflejo commented Dec 2, 2015

Ah just saw it, never mind. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants