From 2a7e1e62d10fbaa38596cbc42acbf6d94efbacc7 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sat, 1 Feb 2020 14:31:24 +0100 Subject: [PATCH] PaintStorage: Prevent division by zero --- boxes/generators/paintbox.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boxes/generators/paintbox.py b/boxes/generators/paintbox.py index ca91b52..1ba33d2 100644 --- a/boxes/generators/paintbox.py +++ b/boxes/generators/paintbox.py @@ -54,6 +54,10 @@ class PaintStorage(Boxes): return n_x = int(self.x / (self.candiameter+self.minspace)) n_y = int(self.y / (self.candiameter+self.minspace)) + + if n_x <= 0 or n_y <= 0: + return + spacing_x = (self.x - n_x*self.candiameter)/n_x spacing_y = (self.y - n_y*self.candiameter)/n_y for i in range(n_y):