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)