@@ -160,7 +160,7 @@ endfunction
160
160
161
161
" Populate the stacktrace window.
162
162
function ! 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 )
164
164
return
165
165
endif
166
166
@@ -785,7 +785,9 @@ function! s:update_goroutines() abort
785
785
let l: res = s: call_jsonrpc (' RPCServer.State' )
786
786
let l: currentGoroutineID = 0
787
787
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
789
791
catch
790
792
call go#util#EchoWarning (" current goroutine not found..." )
791
793
endtry
@@ -812,7 +814,7 @@ function! s:show_goroutines(currentGoroutineID, res) abort
812
814
813
815
let v = [' # Goroutines' ]
814
816
815
- if ! has_key (a: res , ' result' )
817
+ if type ( a: res ) isnot type ({}) || ! has_key (a: res , ' result' ) || empty ( a: res [ ' result ' ] )
816
818
call setline (1 , v )
817
819
return
818
820
endif
@@ -877,14 +879,21 @@ function! s:update_variables() abort
877
879
878
880
try
879
881
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
881
887
catch
882
888
call go#util#EchoError (v: exception )
883
889
endtry
884
890
885
891
try
886
892
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
888
897
catch
889
898
call go#util#EchoError (v: exception )
890
899
endtry
@@ -919,7 +928,7 @@ endfunction
919
928
function ! s: stack_cb (res ) abort
920
929
let s: stack_name = ' '
921
930
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 )
923
932
return
924
933
endif
925
934
0 commit comments