FIX: crash when import svg

Jira: 4084
Change-Id: Ib81631615208b0c884c5ce36211841292c2e3ea3
This commit is contained in:
zhimin.zeng 2023-09-13 11:32:11 +08:00 committed by Lane.Wei
parent 76d073a9ea
commit ff10078fa7
1 changed files with 7 additions and 0 deletions

View File

@ -190,6 +190,10 @@ bool get_svg_profile(const char *path, std::vector<Element_Info> &element_infos,
profile_line_points.push_back({pt1, pt2}); profile_line_points.push_back({pt1, pt2});
} }
} }
if (profile_line_points.empty())
continue;
// keep the start and end points of profile connected // keep the start and end points of profile connected
if (shape->fill.gradient != nullptr) if (shape->fill.gradient != nullptr)
profile_line_points.back().second = profile_line_points[0].first; profile_line_points.back().second = profile_line_points[0].first;
@ -269,6 +273,9 @@ bool get_svg_profile(const char *path, std::vector<Element_Info> &element_infos,
wires.emplace_back(wire); wires.emplace_back(wire);
} }
if (wires.empty())
continue;
gp_Vec dir(0, 0, 10); gp_Vec dir(0, 0, 10);
BRepBuilderAPI_MakeFace face_make(wires[index]); BRepBuilderAPI_MakeFace face_make(wires[index]);
for (int i = 0; i < wires.size(); ++i) { for (int i = 0; i < wires.size(); ++i) {