Skip to content

Commit ea1630d

Browse files
Merge pull request #41 from Elettrotecnica/master
Handle the case where mesh2shape returns null
2 parents 0253cbe + 92ca1a1 commit ea1630d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/body/body.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@ var Body = {
7171
type: ShapeType[data.shape.toUpperCase()]
7272
});
7373

74-
var { shape, offset, orientation } = mesh2shape(this.el.object3D, options);
74+
const shapeInfo = mesh2shape(this.el.object3D, options);
75+
let shape, offset, orientation;
76+
if (shapeInfo) {
77+
({ shape, offset, orientation } = shapeInfo);
78+
}
7579

7680
if (!shape) {
7781
el.addEventListener('object3dset', this.initBody.bind(this));
7882
return;
7983
}
84+
8085
this.body.addShape(shape, offset, orientation);
8186

8287
// Show wireframe

0 commit comments

Comments
 (0)