Check for existence of signs before clearing.

This fixes a bug whereby opening Vim on a non-git tracked file, then
calling `:DisableGitGutter` or `:ToggleGitGutter`, tried to clear a
variable before it had been defined.
This commit is contained in:
Andy Stewart
2013-03-01 09:01:09 +01:00
parent eec6b68d1e
commit 5a48d86dca

View File

@@ -164,7 +164,7 @@ endfunction
" Sign processing {{{ " Sign processing {{{
function! s:clear_signs(file_name) function! s:clear_signs(file_name)
if has_key(s:sign_ids, a:file_name) if exists('s:sign_ids') && has_key(s:sign_ids, a:file_name)
for id in s:sign_ids[a:file_name] for id in s:sign_ids[a:file_name]
exe ":sign unplace " . id . " file=" . a:file_name exe ":sign unplace " . id . " file=" . a:file_name
endfor endfor