Skip to content

Commit a6db6c9

Browse files
ahrexAlexander Huynh
andauthored
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>
1 parent 7882fb9 commit a6db6c9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

autoload/ale/engine.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ function! s:HandleExit(job_info, buffer, output, data) abort
178178
let l:loclist = []
179179
endtry
180180

181+
if type(l:loclist) isnot# v:t_list
182+
" we only expect the list type; don't pass anything else down to
183+
" `ale#engine#HandleLoclist` since it won't understand it
184+
let l:loclist = []
185+
endif
186+
181187
call ale#engine#HandleLoclist(l:linter.name, a:buffer, l:loclist, 0)
182188
endfunction
183189

0 commit comments

Comments
 (0)