Skip to content

Commit 5380857

Browse files
committed
don't error on bad decodes
empty strings, etc
1 parent e2ef6f0 commit 5380857

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/ampache.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ def return_data(self, data):
237237
"""
238238
# json format
239239
if self.AMPACHE_API == 'json':
240-
json_data = json.loads(data.decode('utf-8'))
240+
try:
241+
json_data = json.loads(data.decode('utf-8'))
242+
except json.decoder.JSONDecodeError:
243+
return False
241244
return json_data
242245
# xml format
243246
else:

0 commit comments

Comments
 (0)