fix(client): add an empty array to allow iterating over an array containing newline (#222)

An array containing simply a newline ['\n','other text'] will error on this line.  Adding an empty array to allow it to iterate solves it.
This commit is contained in:
adipose 2020-09-09 21:40:15 -07:00 committed by GitHub
parent 5dd9bc5819
commit 77980b298a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,7 +187,7 @@ class Translator:
data, response = self._translate(text, dest, src, kwargs) data, response = self._translate(text, dest, src, kwargs)
# this code will be updated when the format is changed. # this code will be updated when the format is changed.
translated = ''.join([d[0] if d[0] else '' for d in data[0]]) translated = ''.join([d[0] if d[0] else '' for d in data[0] or []])
extra_data = self._parse_extra_data(data) extra_data = self._parse_extra_data(data)