summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/pyexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/pyexec.c')
-rw-r--r--stmhal/pyexec.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/stmhal/pyexec.c b/stmhal/pyexec.c
index 166f0a6d15..45928427e1 100644
--- a/stmhal/pyexec.c
+++ b/stmhal/pyexec.c
@@ -163,7 +163,11 @@ raw_repl_reset:
}
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, line.buf, line.len, 0);
- parse_compile_execute(lex, MP_PARSE_FILE_INPUT, false);
+ if (lex == NULL) {
+ printf("MemoryError\n");
+ } else {
+ parse_compile_execute(lex, MP_PARSE_FILE_INPUT, false);
+ }
// indicate end of output with EOF character
stdout_tx_str("\004");
@@ -239,7 +243,11 @@ friendly_repl_reset:
}
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr_str(&line), vstr_len(&line), 0);
- parse_compile_execute(lex, MP_PARSE_SINGLE_INPUT, true);
+ if (lex == NULL) {
+ printf("MemoryError\n");
+ } else {
+ parse_compile_execute(lex, MP_PARSE_SINGLE_INPUT, true);
+ }
}
}