Check existence of variable before trying to set it

closes #1924
This commit is contained in:
Christian Brabandt 2019-05-24 08:13:31 +02:00
parent 3abbfabf55
commit 193e350440
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -66,7 +66,8 @@ endfunction
function! s:set_clean_variables(file, vcs, val)
let var=getbufvar(fnameescape(a:file), 'buffer_vcs_config', {})
if has_key(var, a:vcs) && has_key(var[a:vcs], 'dirty')
if has_key(var, a:vcs) && has_key(var[a:vcs], 'dirty') &&
\ type(getbufvar(fnameescape(a:file), 'buffer_vcs_config')) == type({})
let var[a:vcs].dirty=a:val
call setbufvar(fnameescape(a:file), 'buffer_vcs_config', var)
unlet! b:airline_head