Fix json tests by checking for zero read from stream

This commit is contained in:
Scott Shawcroft 2023-10-05 11:33:06 -07:00
parent 58db1722da
commit f8996cb202
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
1 changed files with 3 additions and 0 deletions

View File

@ -176,6 +176,9 @@ STATIC mp_uint_t ujson_python_readinto(mp_obj_t obj, void *buf, mp_uint_t size,
}
s->start = 0;
s->end = mp_obj_get_int(ret);
if (s->end == 0) {
return 0;
}
}
*((uint8_t *)buf) = ((uint8_t *)s->bytearray_obj.items)[s->start];