Skip to content

Commit

Permalink
Merge pull request #139 from mtgto/avoid-fatal-error-candidate-panel
Browse files Browse the repository at this point in the history
変換候補パネルで状態がおかしいときにクラッシュさせないように修正
  • Loading branch information
mtgto authored Mar 17, 2024
2 parents c104fc1 + 3c9cd2b commit c12c222
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion macSKK/View/CandidatesPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ final class CandidatesPanel: NSPanel {
* - 右にはみ出す場合: スクリーン右端に接するように表示する
*/
func show(windowLevel: NSWindow.Level) {
// 原因は特定できてないが特殊な場合 (終了が要求されているときなど?) で下記の分岐がfalseになるケースがあったので対処
guard let viewController = contentViewController as? NSHostingController<CandidatesView> else {
fatalError("ビューコントローラの状態が壊れている")
logger.error("ビューコントローラの状態が想定と異なるため変換候補パネルを表示できません")
return
}
#if DEBUG
print("content size = \(viewController.sizeThatFits(in: CGSize(width: Int.max, height: Int.max)))")
Expand Down

0 comments on commit c12c222

Please sign in to comment.