@@ -160,7 +160,7 @@ endfunction
160160
161161" Populate the stacktrace window.
162162function ! s: show_stacktrace (res ) abort
163- if ! has_key (a: res , ' result' )
163+ if type ( a: res ) isnot type ({}) || ! has_key (a: res , ' result' ) || empty ( a: res .result )
164164 return
165165 endif
166166
@@ -785,7 +785,9 @@ function! s:update_goroutines() abort
785785 let l: res = s: call_jsonrpc (' RPCServer.State' )
786786 let l: currentGoroutineID = 0
787787 try
788- let l: currentGoroutineID = l: res [" result" ][" State" ][" currentGoroutine" ][" id" ]
788+ if type (l: res ) is type ({}) && has_key (l: res , ' result' ) && ! empty (l: res [' result' ])
789+ let l: currentGoroutineID = l: res [" result" ][" State" ][" currentGoroutine" ][" id" ]
790+ endif
789791 catch
790792 call go#util#EchoWarning (" current goroutine not found..." )
791793 endtry
@@ -812,7 +814,7 @@ function! s:show_goroutines(currentGoroutineID, res) abort
812814
813815 let v = [' # Goroutines' ]
814816
815- if ! has_key (a: res , ' result' )
817+ if type ( a: res ) isnot type ({}) || ! has_key (a: res , ' result' ) || empty ( a: res [ ' result ' ] )
816818 call setline (1 , v )
817819 return
818820 endif
@@ -877,14 +879,21 @@ function! s:update_variables() abort
877879
878880 try
879881 let res = s: call_jsonrpc (' RPCServer.ListLocalVars' , l: cfg )
880- let s: state [' localVars' ] = res .result[' Variables' ]
882+
883+ let s: state [' localVars' ] = {}
884+ if type (l: res ) is type ({}) && has_key (l: res , ' result' ) && ! empty (l: res .result)
885+ let s: state [' localVars' ] = l: res .result[' Variables' ]
886+ endif
881887 catch
882888 call go#util#EchoError (v: exception )
883889 endtry
884890
885891 try
886892 let res = s: call_jsonrpc (' RPCServer.ListFunctionArgs' , l: cfg )
887- let s: state [' functionArgs' ] = res .result[' Args' ]
893+ let s: state [' functionArgs' ] = {}
894+ if type (l: res ) is type ({}) && has_key (l: res , ' result' ) && ! empty (l: res .result)
895+ let s: state [' functionArgs' ] = res .result[' Args' ]
896+ endif
888897 catch
889898 call go#util#EchoError (v: exception )
890899 endtry
@@ -919,7 +928,7 @@ endfunction
919928function ! s: stack_cb (res ) abort
920929 let s: stack_name = ' '
921930
922- if empty (a: res ) || ! has_key (a: res , ' result' )
931+ if type (a: res ) isnot type ({}) || ! has_key (a: res , ' result' ) || empty ( a: res .result )
923932 return
924933 endif
925934
0 commit comments