Commit e5a15cb7 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

mp_obj_new_list(n, items): Copy items only if not-NULL.

Similar to mp_obj_new_tuple().
parent 0c59db19
......@@ -435,8 +435,10 @@ static mp_obj_list_t *list_new(uint n) {
mp_obj_t mp_obj_new_list(uint n, mp_obj_t *items) {
mp_obj_list_t *o = list_new(n);
for (int i = 0; i < n; i++) {
o->items[i] = items[i];
if (items != NULL) {
for (int i = 0; i < n; i++) {
o->items[i] = items[i];
}
}
return o;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment