summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/objstr.c b/py/objstr.c
index 4ec1034e1e..67de2ce804 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -355,6 +355,9 @@ STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (!mp_seq_get_fast_slice_indexes(self_len, index, &start, &stop)) {
assert(0);
}
+ if (start >= stop) {
+ return MP_OBJ_NEW_QSTR(MP_QSTR_);
+ }
return str_new(type, self_data + start, stop - start);
}
#endif