From d27552add22f2948589ba22be24c153640d37292 Mon Sep 17 00:00:00 2001 From: Albert Schulz Date: Fri, 16 Jan 2015 09:42:53 +0100 Subject: [PATCH] Update CALayer+ModalAlert.m Fixes crash when using iOS 8 Webkit Issue: https://github.com/lmcd/LMAlertView/issues/51 --- LMAlertView/CALayer+ModalAlert.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LMAlertView/CALayer+ModalAlert.m b/LMAlertView/CALayer+ModalAlert.m index 085311c..cc98842 100644 --- a/LMAlertView/CALayer+ModalAlert.m +++ b/LMAlertView/CALayer+ModalAlert.m @@ -25,9 +25,18 @@ + (void)load - (UIWindow *)windowForView:(UIView *)view { + if (![view respondsToSelector:@selector(superview)]) { + return nil; + } + UIView *tempView = view; while (tempView.superview != nil) { + + if (![tempView respondsToSelector:@selector(superview)]) { + break; + } + tempView = tempView.superview; if ([tempView isKindOfClass:[UIWindow class]]) {