Skip to content

Commit 7b34bca

Browse files
authored
Merge pull request #250 from hikouki/fix-issue-186
#186 openAuth crashed when going to be closed and then press the cancel button
2 parents af3dee2 + 309cd4d commit 7b34bca

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

ios/RNInAppBrowser.m

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,18 @@ + (BOOL)requiresMainQueueSetup
7575
void (^completionHandler)(NSURL * _Nullable, NSError *_Nullable) = ^(NSURL* _Nullable callbackURL, NSError* _Nullable error) {
7676
__strong typeof(weakSelf) strongSelf = weakSelf;
7777
if (strongSelf) {
78-
if (!error) {
79-
NSString *url = callbackURL.absoluteString;
80-
redirectResolve(@{
81-
@"type" : @"success",
82-
@"url" : url,
83-
});
84-
} else {
85-
redirectResolve(@{
86-
@"type" : @"cancel",
87-
});
78+
if (redirectResolve) {
79+
if (!error) {
80+
NSString *url = callbackURL.absoluteString;
81+
redirectResolve(@{
82+
@"type" : @"success",
83+
@"url" : url,
84+
});
85+
} else {
86+
redirectResolve(@{
87+
@"type" : @"cancel",
88+
});
89+
}
8890
}
8991
[strongSelf flowDidFinish];
9092
}

0 commit comments

Comments
 (0)