add guard for possible undefined window context (#276).

This commit is contained in:
Bailey Ling 2013-10-06 09:03:47 -04:00
parent af330f6a47
commit 491091706f

View File

@ -120,7 +120,12 @@ function! s:invoke_funcrefs(context, funcrefs)
endfunction endfunction
function! airline#statusline(winnr) function! airline#statusline(winnr)
if has_key(s:contexts, a:winnr)
return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line
endif
" in rare circumstances this happens...see #276
return ''
endfunction endfunction
function! airline#check_mode(winnr) function! airline#check_mode(winnr)