diff options
author | Ghostkeeper <rubend@tutanota.com> | 2020-05-25 18:20:33 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2020-05-25 18:20:39 +0300 |
commit | edf7fdad75e0221c02821147b1e93715338e490b (patch) | |
tree | c4c2961ebb657b41c949bd68e4b0117e068cbc2c | |
parent | 715e5a890ea9d2640b1d73749a0c960e8a05b5c5 (diff) |
Check first if we have valid vertex data
The convex hull calculation may fail. If it does, we want to just tomit the convex hull shadow, rather than crash.
Fixes Sentry issue CURA-ST.
-rw-r--r-- | cura/Scene/ConvexHullDecorator.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cura/Scene/ConvexHullDecorator.py b/cura/Scene/ConvexHullDecorator.py index b5f5fb4540..c1e6a352b9 100644 --- a/cura/Scene/ConvexHullDecorator.py +++ b/cura/Scene/ConvexHullDecorator.py @@ -224,7 +224,7 @@ class ConvexHullDecorator(SceneNodeDecorator): if self._node is None: return None if self._node.callDecoration("isGroup"): - points = numpy.zeros((0, 2), dtype=numpy.int32) + points = numpy.zeros((0, 2), dtype = numpy.int32) for child in self._node.getChildren(): child_hull = child.callDecoration("_compute2DConvexHull") if child_hull: @@ -268,7 +268,7 @@ class ConvexHullDecorator(SceneNodeDecorator): # Do not throw away vertices: the convex hull may be too small and objects can collide. # vertex_data = vertex_data[vertex_data[:,1] >= -0.01] - if len(vertex_data) >= 4: # type: ignore # mypy and numpy don't play along well just yet. + if vertex_data is not None and len(vertex_data) >= 4: # type: ignore # mypy and numpy don't play along well just yet. # Round the vertex data to 1/10th of a mm, then remove all duplicate vertices # This is done to greatly speed up further convex hull calculations as the convex hull # becomes much less complex when dealing with highly detailed models. |