#8252 - GCodeViewer - Fixed crash when importing invalid gcode

This commit is contained in:
enricoturri1966 2022-11-07 12:52:10 +01:00
parent 411535ecdf
commit 8abb8a6546
4 changed files with 29 additions and 3 deletions

View file

@ -223,7 +223,10 @@ bool Bed3D::set_shape(const Pointfs& bed_shape, const double max_print_height, c
#if ENABLE_LEGACY_OPENGL_REMOVAL
m_contour = ExPolygon(Polygon::new_scale(bed_shape));
m_polygon = offset(m_contour.contour, (float)m_contour.contour.bounding_box().radius() * 1.7f, jtRound, scale_(0.5)).front();
const BoundingBox bbox = m_contour.contour.bounding_box();
if (!bbox.defined)
throw RuntimeError(std::string("Invalid bed shape"));
m_polygon = offset(m_contour.contour, (float)bbox.radius() * 1.7f, jtRound, scale_(0.5)).front();
m_triangles.reset();
m_gridlines.reset();