Skip to content
Snippets Groups Projects
Commit 1b8aedce authored by moon2's avatar moon2 :speech_balloon:
Browse files

micropython: json: indent: handle neg indent gracefully

third time's the charm mayhaps
parent 755d7e83
Branches
Tags
1 merge request!706micropython: json: indent: handle neg indent gracefully
Pipeline #13094 passed
......@@ -59,7 +59,8 @@ STATIC mp_obj_t mod_ujson_dump_helper(size_t n_args, const mp_obj_t *pos_args, m
print_ext.indent_depth = 0;
if (indent != mp_const_none) {
if (mp_obj_is_int(indent)) {
mp_uint_t len_whitespace = mp_obj_get_int(indent);
mp_int_t len_whitespace = mp_obj_get_int(indent);
len_whitespace = len_whitespace > 0 ? len_whitespace : 0;
char * whitespace = m_malloc(len_whitespace + 1);
memset(whitespace, ' ', len_whitespace);
whitespace[len_whitespace] = '\0';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment