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 3c49b9cf3d
commit 46db9b9bdf

View File

@ -122,18 +122,24 @@ 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
for winnr in range(1, winnr('$')) if !empty(colors)
if winnr != a:winnr for winnr in range(1, winnr('$'))
\ && has_key(s:contexts, winnr) if winnr != a:winnr
\ && s:contexts[winnr].bufnr == context.bufnr \ && has_key(s:contexts, winnr)
call airline#highlighter#exec('airline_c'.(context.bufnr).'_inactive', colors) \ && s:contexts[winnr].bufnr == context.bufnr
endif call airline#highlighter#exec('airline_c'.(context.bufnr).'_inactive', colors)
endfor endif
endfor
endif
endif endif
if g:airline_detect_paste && &paste if g:airline_detect_paste && &paste