check existence of inactive modified colors before using them.

This commit is contained in:
Bailey Ling 2013-09-05 21:01:08 +00:00
parent 5754bcabce
commit 83bbd09b0e

View File

@ -122,11 +122,16 @@ function! airline#check_mode(winnr)
if g:airline_detect_modified if g:airline_detect_modified
if &modified if &modified
call add(l:mode, 'modified') call add(l:mode, 'modified')
let colors = g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c
\ : []
else else
let colors = g:airline#themes#{g:airline_theme}#palette.inactive.airline_c let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c
\ : []
endif endif
if !empty(colors)
for winnr in range(1, winnr('$')) for winnr in range(1, winnr('$'))
if winnr != a:winnr if winnr != a:winnr
\ && has_key(s:contexts, winnr) \ && has_key(s:contexts, winnr)
@ -135,6 +140,7 @@ function! airline#check_mode(winnr)
endif endif
endfor endfor
endif endif
endif
if g:airline_detect_paste && &paste if g:airline_detect_paste && &paste
call add(l:mode, 'paste') call add(l:mode, 'paste')