mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-03 19:45:56 +03:00
Avoid divide by zero
This commit is contained in:
parent
8b7a989018
commit
0df43e4f93
|
@ -1153,8 +1153,11 @@ def _save(im, fp, filename):
|
|||
# following tiffcp.c->cpTag->TIFF_RATIONAL
|
||||
atts[k] = float(v[0][0])/float(v[0][1])
|
||||
continue
|
||||
if type(v) == tuple and len(v) > 2:
|
||||
if (type(v) == tuple and
|
||||
(len(v) > 2 or
|
||||
(len(v) == 2 and v[1] == 0))):
|
||||
# List of ints?
|
||||
# Avoid divide by zero in next if-clause
|
||||
if type(v[0]) in (int, float):
|
||||
atts[k] = list(v)
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue
Block a user