themes: correctly catch not-found in init function

plugin/airline.vim was calling airline#switch_theme() without actually
catching the 'not-found' exception.

Therefore, in case of errors, explicitly switch to a dark theme.

closes #1903
This commit is contained in:
Christian Brabandt 2019-04-17 08:25:55 +02:00
parent 773f0e3637
commit d1d9548b8e
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -29,7 +29,13 @@ function! s:init()
call airline#util#warning(printf('Could not resolve airline theme "%s". Themes have been migrated to github.com/vim-airline/vim-airline-themes.', g:airline_theme))
let g:airline_theme = 'dark'
endtry
silent call airline#switch_theme(g:airline_theme)
try
silent call airline#switch_theme(g:airline_theme)
catch
call airline#util#warning(printf('Could not find airline theme "%s".', g:airline_theme))
let g:airline_theme = 'dark'
silent call airline#switch_theme(g:airline_theme)
endtry
else
let g:airline_theme = 'dark'
silent call s:on_colorscheme_changed()