RefactoringRope/JsonClient.py

changeset 243
8ea03231bd47
parent 241
e7d5da53faac
child 245
75a35a927952
--- a/RefactoringRope/JsonClient.py	Sun Dec 24 17:03:03 2017 +0100
+++ b/RefactoringRope/JsonClient.py	Sun Dec 31 15:09:23 2017 +0100
@@ -72,12 +72,17 @@
         # step 1: receive the data
         # The JSON RPC string is prefixed by a 9 character long length field.
         length = self.__connection.recv(9)
+        if len(length) < 9:
+            # invalid length string received
+            return None, None
+        
         length = int(length)
         data = b''
         while len(data) < length:
             newData = self.__connection.recv(length - len(data))
             if not newData:
                 return None, None
+            
             data += newData
         
         # step 2: decode and convert the data

eric ide

mercurial