pylightning: Handle empty log lines correctly

Logging an empty line (without newline character) would raise an
Exception due to out of bounds check.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2019-01-21 18:28:33 +01:00 committed by Rusty Russell
parent 5d05694920
commit 1c8b980985

View File

@ -343,7 +343,7 @@ class PluginStream(object):
def write(self, payload):
self.buff += payload
if payload[-1] == '\n':
if len(payload) > 0 and payload[-1] == '\n':
self.flush()
def flush(self):