Skip to content

Commit f72b6f8

Browse files
committed
don't show error when coin without images
1 parent 45e2abd commit f72b6f8

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

backend/app.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def photo(f, id, type):
166166
if img_type == 'both':
167167
img1 = None
168168
img2 = None
169+
img = None
169170
new_width1 = 0
170171
new_width2 = 0
171172

@@ -191,9 +192,10 @@ def photo(f, id, type):
191192
if img2:
192193
new_img.paste(img2, (new_width1, 0))
193194

194-
buffered = BytesIO()
195-
new_img.save(buffered, format="WEBP", lossless=False, quality=80)
196-
img = buffered.getvalue()
195+
if img1 or img2:
196+
buffered = BytesIO()
197+
new_img.save(buffered, format="WEBP", lossless=False, quality=80)
198+
img = buffered.getvalue()
197199
else:
198200
img = data[0][0]
199201

0 commit comments

Comments
 (0)