diff options
Diffstat (limited to 'py/objlist.c')
-rw-r--r-- | py/objlist.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/objlist.c b/py/objlist.c index 655a78908e..578e39452a 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -131,6 +131,9 @@ STATIC mp_obj_t list_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { if (!mp_obj_get_int_maybe(rhs, &n)) { return MP_OBJ_NULL; // op not supported } + if (n < 0) { + n = 0; + } mp_obj_list_t *s = list_new(o->len * n); mp_seq_multiply(o->items, sizeof(*o->items), o->len, n, s->items); return s; |