skip logging ZeroDivisionError on negative text areas
authorJan Szejko <janek37@gmail.com>
Fri, 21 Jul 2017 10:29:03 +0000 (12:29 +0200)
committerJan Szejko <janek37@gmail.com>
Fri, 21 Jul 2017 10:29:03 +0000 (12:29 +0200)
src/picture/templatetags/picture_tags.py

index b31405b..a766b44 100644 (file)
@@ -55,6 +55,8 @@ def area_thumbnail_url(area, geometry):
             area.picture.image_file,
             geometry,
             crop="%dpx %dpx %dpx %dpx" % tuple(map(lambda d: max(0, d), tuple(coords[0] + coords[1]))))
+    except ZeroDivisionError:
+        return ''
     except Exception, e:
         logging.exception("Error creating a thumbnail for PictureArea")
         return ''