Skip to content

Commit cdd79ca

Browse files
korovyevE-B-Smith
authored andcommitted
Fix for crash on pre iOS 11 where the application delegate does not have a window variable (#772)
1 parent 4d74797 commit cdd79ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Branch-SDK/Branch-SDK/UIViewController+Branch.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ + (UIWindow*_Nullable) bnc_currentWindow {
1515
if (UIApplicationClass) {
1616
UIWindow *keyWindow = nil;
1717

18-
keyWindow = [UIApplicationClass sharedApplication].delegate.window;
18+
if ([[UIApplicationClass sharedApplication].delegate respondsToSelector:@selector(window)]) {
19+
keyWindow = [UIApplicationClass sharedApplication].delegate.window;
20+
}
1921
if (keyWindow && !keyWindow.isHidden && keyWindow.rootViewController) return keyWindow;
2022

2123
keyWindow = [UIApplicationClass sharedApplication].keyWindow;

0 commit comments

Comments
 (0)