Skip to content

Commit 6c82f9e

Browse files
committed
protecting against not having a keywindow
1 parent 82acc58 commit 6c82f9e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

iOS_SDK/OneSignalSDK/Source/OSInAppMessageViewController.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ - (NSString *)setContentInsetsInHTML:(NSString *)html {
276276
NSMutableString *newHTML = [[NSMutableString alloc] initWithString:html];
277277
if (@available(iOS 11, *)) {
278278
UIWindow *keyWindow = UIApplication.sharedApplication.keyWindow;
279+
if (!keyWindow) {
280+
return newHTML;
281+
}
279282
CGFloat top = keyWindow.safeAreaInsets.top;
280283
CGFloat bottom = keyWindow.safeAreaInsets.bottom;
281284
CGFloat right = keyWindow.safeAreaInsets.right;

0 commit comments

Comments
 (0)