From ab2b181012fcd716d5c6491639338e81d2179d39 Mon Sep 17 00:00:00 2001
From: w0rp <devw0rp@gmail.com>
Date: Fri, 13 Jul 2018 09:47:26 +0100
Subject: [PATCH] Handle linter callback functions being unknown or deleted

---
 autoload/ale/engine.vim | 7 ++++++-
 doc/ale.txt             | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 247dcbe7..c16bc404 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -221,7 +221,12 @@ function! s:HandleExit(job_id, exit_code) abort
         call ale#history#RememberOutput(l:buffer, a:job_id, l:output[:])
     endif
 
-    let l:loclist = ale#util#GetFunction(l:linter.callback)(l:buffer, l:output)
+    try
+        let l:loclist = ale#util#GetFunction(l:linter.callback)(l:buffer, l:output)
+    " Handle the function being unknown, or being deleted.
+    catch /E700/
+        let l:loclist = []
+    endtry
 
     call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist)
 endfunction
diff --git a/doc/ale.txt b/doc/ale.txt
index 232d7630..2d956af2 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -2206,6 +2206,10 @@ ale#linter#Define(filetype, linter)                       *ale#linter#Define()*
                          defined, as LSP linters handle diagnostics
                          automatically. See |ale-lsp-linters|.
 
+                         If the function named does not exist, including if
+                         the function is later deleted, ALE will behave as if
+                         the callback returned an empty list.
+
                          The keys for each item in the List will be handled in
                          the following manner:
                                                            *ale-loclist-format*