From 65730623f227753f06585c2a8c5b64b7ca94e61c Mon Sep 17 00:00:00 2001 From: Solomiya Nazarkevych Date: Wed, 31 May 2017 17:49:22 +0300 Subject: [PATCH] Prevented crash when [alert show] is called twice in a row. --- Pod/Classes/UIAlertController+Window.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Pod/Classes/UIAlertController+Window.m b/Pod/Classes/UIAlertController+Window.m index f7221ce..a4c75b9 100644 --- a/Pod/Classes/UIAlertController+Window.m +++ b/Pod/Classes/UIAlertController+Window.m @@ -36,6 +36,10 @@ - (void)show { } - (void)show:(BOOL)animated { + if (self.presentingViewController) { + return; + } + self.alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.alertWindow.rootViewController = [[UIViewController alloc] init]; self.alertWindow.windowLevel = UIWindowLevelAlert + 1;