From ecf10d0e58fc1218d1b25cca4e30e63f9f923bf6 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 21 Sep 2018 11:49:05 +0200 Subject: [PATCH] wordcount: check that the retun value has the dict key else it will throw an error. --- autoload/airline/extensions/wordcount.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index d569ea8..a098bb1 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -7,7 +7,11 @@ scriptencoding utf-8 if exists('*wordcount') function! s:get_wordcount(visual_mode_active) let query = a:visual_mode_active ? 'visual_words' : 'words' - return string(wordcount()[query]) + let result = wordcount() + if has_key(result, query) + return string(result[query]) + endif + return '' endfunction else function! s:get_wordcount(visual_mode_active)