mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 05:04:28 +08:00
more defensive coding: guard against a non-iterable loclist (#4912)
Sometimes `s:HandleExit` can execute a deferred linter callback, which ends up setting the `l:loclist` that's passed into `ale#engine#HandleLoclist` at the end of `s:HandleExit` to a dictionary. This dictionary cannot be iterated over, and thus errors out. Guard against trying to iterate over values that don't make sense. Co-authored-by: Alexander Huynh <git@e.sc>
This commit is contained in:
@@ -178,6 +178,12 @@ function! s:HandleExit(job_info, buffer, output, data) abort
|
||||
let l:loclist = []
|
||||
endtry
|
||||
|
||||
if type(l:loclist) isnot# v:t_list
|
||||
" we only expect the list type; don't pass anything else down to
|
||||
" `ale#engine#HandleLoclist` since it won't understand it
|
||||
let l:loclist = []
|
||||
endif
|
||||
|
||||
call ale#engine#HandleLoclist(l:linter.name, a:buffer, l:loclist, 0)
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user