diff --git a/src/main/java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt b/src/main/java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt index cc8e8c551f..80184771f7 100644 --- a/src/main/java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt +++ b/src/main/java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt @@ -66,7 +66,7 @@ internal class IjActionExecutor : VimActionExecutor { * @param ijAction The action to execute * @param context The context to run it in */ - override fun executeAction(editor: VimEditor, action: NativeAction, context: ExecutionContext): Boolean { + override fun executeAction(editor: VimEditor?, action: NativeAction, context: ExecutionContext): Boolean { val ijAction = (action as IjNativeAction).action /** @@ -77,7 +77,10 @@ internal class IjActionExecutor : VimActionExecutor { dataContext.putUserData(runFromVimKey, true) val contextComponent = PlatformCoreDataKeys.CONTEXT_COMPONENT.getData(dataContext) - ?: editor.ij.component + ?: editor?.ij?.component ?: run { + LOG.error("Cannot get context component") + return false + } val result = withRunningAction { val result = withStringRegistryOption { diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/VimActionExecutor.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/VimActionExecutor.kt index 5c114a6fdf..2b9d58d8d6 100644 --- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/VimActionExecutor.kt +++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/VimActionExecutor.kt @@ -27,7 +27,7 @@ interface VimActionExecutor { * @param action The action to execute * @param context The context to run it in */ - fun executeAction(editor: VimEditor, action: NativeAction, context: ExecutionContext): Boolean + fun executeAction(editor: VimEditor?, action: NativeAction, context: ExecutionContext): Boolean /** * Execute an action by name