FIX: crash when generating text with thickness <= 0

github: 4122
Change-Id: I0fae6ea234ddb92ef2c2bec6e0f8f7555709ec4f
This commit is contained in:
zhimin.zeng 2024-05-20 18:50:24 +08:00 committed by SoftFever
parent 022c2ff53e
commit 0886610160
2 changed files with 4 additions and 1 deletions

View file

@ -241,6 +241,9 @@ static void MakeMesh(TopoDS_Shape& theSolid, TriangleMesh& theMesh)
void load_text_shape(const char*text, const char* font, const float text_height, const float thickness, bool is_bold, bool is_italic, TextResult &text_result) void load_text_shape(const char*text, const char* font, const float text_height, const float thickness, bool is_bold, bool is_italic, TextResult &text_result)
{ {
if (thickness <= 0)
return;
Handle(Font_FontMgr) aFontMgr = Font_FontMgr::GetInstance(); Handle(Font_FontMgr) aFontMgr = Font_FontMgr::GetInstance();
if (aFontMgr->GetAvailableFonts().IsEmpty()) if (aFontMgr->GetAvailableFonts().IsEmpty())
aFontMgr->InitFontDataBase(); aFontMgr->InitFontDataBase();

View file

@ -386,7 +386,7 @@ bool GLGizmoText::gizmo_event(SLAGizmoEventType action, const Vec2d &mouse_posit
return false; return false;
Plater *plater = wxGetApp().plater(); Plater *plater = wxGetApp().plater();
if (!plater) if (!plater || m_thickness <= 0)
return true; return true;
ModelObject *model_object = selection.get_model()->objects[m_object_idx]; ModelObject *model_object = selection.get_model()->objects[m_object_idx];