From 101cf71718e78b188946c1598a3b136f59db5514 Mon Sep 17 00:00:00 2001 From: Ezequiel Rosas Date: Mon, 7 Aug 2017 15:55:32 -0500 Subject: [PATCH] On ocasions, NSTextInputContext comes as null. --- SwiftNeoVim/NeoVimView+Key.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SwiftNeoVim/NeoVimView+Key.swift b/SwiftNeoVim/NeoVimView+Key.swift index e9b28069..cde4505e 100644 --- a/SwiftNeoVim/NeoVimView+Key.swift +++ b/SwiftNeoVim/NeoVimView+Key.swift @@ -10,8 +10,8 @@ extension NeoVimView { override public func keyDown(with event: NSEvent) { self.keyDownDone = false - let context = NSTextInputContext.current()! - let cocoaHandledEvent = context.handleEvent(event) + let context = NSTextInputContext.current() + let cocoaHandledEvent = context?.handleEvent(event) ?? false if self.keyDownDone && cocoaHandledEvent { return }