Skip to content

Commit

Permalink
⚡ Only use sheet modal if key window available
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKai77 committed Dec 30, 2024
1 parent 4f190a2 commit 6a435f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Loop/Utilities/Migrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ private extension Migrator {
alert.informativeText = informativeText
buttons.forEach { alert.addButton(withTitle: $0) }

return await alert.beginSheetModal(for: NSApplication.shared.mainWindow ?? NSApp.keyWindow ?? NSApp.windows[0])
if let window = NSApp.keyWindow ?? NSApp.mainWindow {
return await alert.beginSheetModal(for: window)
} else {
return alert.runModal()
}
}

/// Enum to represent the decision made in the import decision alert.
Expand Down

0 comments on commit 6a435f4

Please sign in to comment.