From 227ce4f78892b7b356484537f8da0710dace6ca3 Mon Sep 17 00:00:00 2001 From: Balazs Szamody Date: Fri, 22 Apr 2022 09:55:36 +1000 Subject: [PATCH] - fixed an issue when the heightConstraint receives an infinite value --- Sources/KeyboardLayoutGuide/KeyboardLayoutGuide.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/KeyboardLayoutGuide/KeyboardLayoutGuide.swift b/Sources/KeyboardLayoutGuide/KeyboardLayoutGuide.swift index 11e097f..2e54760 100644 --- a/Sources/KeyboardLayoutGuide/KeyboardLayoutGuide.swift +++ b/Sources/KeyboardLayoutGuide/KeyboardLayoutGuide.swift @@ -127,7 +127,11 @@ open class KeyboardLayoutGuide: UILayoutGuide { height -= bottomDifference } - + guard height != .infinity else { + // When the app is running in multiple windows, it can happen that both windows are `foregroundActive` + // and the intersection frame's origin can become infinite as the owning view is in the other window and the app would crash. + return + } heightConstraint?.constant = height if duration > 0.0 { animate(note)