mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Avoid div-by-zero in fit_image
This commit is contained in:
parent
8ed76a284a
commit
3ac4dc6e43
@ -345,6 +345,8 @@ def fit_image(width, height, pwidth, pheight):
|
||||
@param pheight: Height of box
|
||||
@return: scaled, new_width, new_height. scaled is True iff new_width and/or new_height is different from width or height.
|
||||
'''
|
||||
if height < 1 or width < 1:
|
||||
return False, int(width), int(height)
|
||||
scaled = height > pheight or width > pwidth
|
||||
if height > pheight:
|
||||
corrf = pheight / float(height)
|
||||
|
Loading…
x
Reference in New Issue
Block a user