1
0
forked from aniani/vim

patch 7.4.1278

Problem:    When jsonencode() fails it still returns something.
Solution:   Return an empty string on failure.
This commit is contained in:
Bram Moolenaar
2016-02-07 16:53:13 +01:00
parent a6f72ba7c6
commit 55fab439a6
6 changed files with 47 additions and 12 deletions

View File

@@ -93,6 +93,13 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
print("sending: {}".format(cmd))
self.request.sendall(cmd.encode('utf-8'))
response = "ok"
elif decoded[1] == 'eval-error':
# Send an eval request that works but the result can't
# be encoded.
cmd = '["eval","function(\\"tr\\")", -3]'
print("sending: {}".format(cmd))
self.request.sendall(cmd.encode('utf-8'))
response = "ok"
elif decoded[1] == 'eval-bad':
# Send an eval request missing the third argument.
cmd = '["eval","xxx"]'