Skip to content

Commit ee5159b

Browse files
JuntongMapymumu
JuntongMa
authored andcommitted
Fixed the problem when meta transfers an empty array, out-of-bounds array
1 parent b2c4afd commit ee5159b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/drivers/common/python/modelbox_api/modelbox_api.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,14 @@ bool SetAttributes(DataType &context, const std::string &key,
152152

153153
if (py::isinstance<py::list>(obj)) {
154154
py::list obj_list_all = obj.cast<py::list>();
155+
if (obj_list_all.empty()) {
156+
return setup_data(List1DObjectFunc, obj_list_all, obj_list_all);
157+
}
155158
if (py::isinstance<py::list>(obj_list_all[0])) {
156159
py::list obj_list_1d = obj_list_all[0].cast<py::list>();
160+
if (obj_list_1d.empty()) {
161+
return setup_data(List2DObjectFunc, obj_list_1d, obj_list_all);
162+
}
157163
if (setup_data(List2DObjectFunc, obj_list_1d[0], obj_list_all)) {
158164
return true;
159165
}

0 commit comments

Comments
 (0)