From fcf19a6d525323267a7994b18dc2583f73708671 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Fri, 1 Jun 2018 19:55:51 +0100 Subject: [PATCH] More workarounds for free-and-loose-with-the-spec servers --- python3/vimspector/stack_trace.py | 4 ++++ python3/vimspector/variables.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/python3/vimspector/stack_trace.py b/python3/vimspector/stack_trace.py index aefb74d..4358e94 100644 --- a/python3/vimspector/stack_trace.py +++ b/python3/vimspector/stack_trace.py @@ -62,6 +62,10 @@ class StackTraceView( object ): def consume_threads( message ): self._threads.clear() + if not message[ 'body' ][ 'threads' ]: + # This is a protocol error. It is required to return at least one! + raise ValueError( 'Server returned no threads. Is it running?' ) + for thread in message[ 'body' ][ 'threads' ]: self._threads.append( thread ) diff --git a/python3/vimspector/variables.py b/python3/vimspector/variables.py index de53f48..c83bf44 100644 --- a/python3/vimspector/variables.py +++ b/python3/vimspector/variables.py @@ -179,7 +179,7 @@ class VariablesView( object ): '_variables' not in variable ) else '-', name = variable[ 'name' ], type_ = variable.get( 'type', '' ), - value = variable[ 'value' ] ).split( '\n' ) ) + value = variable.get( 'value', '' ) ).split( '\n' ) ) if '_variables' in variable: self._DrawVariables( variable[ '_variables' ], indent + 2 )