languageclient: check for existence of 'result' key

fixes #1861
This commit is contained in:
Christian Brabandt 2019-01-28 11:21:32 +01:00
parent 9355e683cd
commit 98bc6abde3
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,6 @@
" MIT License. Copyright (c) 2013-2018 Bjorn Neergaard, hallettj et al.
" This comes from the Languageclient plugin:
" https://github.com/autozimu/LanguageClient-neovim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@ -25,8 +27,11 @@ function! s:languageclient_refresh()
endfunction
function! s:record_diagnostics(state)
let result = json_decode(a:state.result)
let s:diagnostics = result.diagnostics
" The returned message might not have the 'result' key
if has_key(a:state, 'result')
let result = json_decode(a:state.result)
let s:diagnostics = result.diagnostics
endif
call s:languageclient_refresh()
endfunction