Skip to content

Commit 226cd1c

Browse files
committed
Fix error when "hunk" does not exist in sy
Error ```console Error detected while processing function sy#util#refresh_windows[9]..sy#start[51]..sy#stop[3]..sy#sign#remove_all_signs: line 3: E716: Key not present in Dictionary: hunks ``` Solution Defensive programming. Ensure to have values for each required variables in `sy#sign#remove_all_signs`.
1 parent c3d450e commit 226cd1c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

autoload/sy/sign.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ endfunction
159159

160160
" #remove_all_signs {{{1
161161
function! sy#sign#remove_all_signs(bufnr) abort
162-
let sy = getbufvar(a:bufnr, 'sy')
162+
let sy = getbufvar(a:bufnr, 'sy', {})
163163

164-
for hunk in sy.hunks
165-
for id in hunk.ids
164+
for hunk in get(sy, 'hunks', [])
165+
for id in get(hunk, 'ids', [])
166166
execute 'sign unplace' id 'buffer='.a:bufnr
167167
endfor
168168
endfor

0 commit comments

Comments
 (0)