Commit 0bc15941 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py: Make mp_obj_print() handle null object w/o segfault if debug build.

Happens regularly when used for debugging.
parent 7067d69b
......@@ -59,6 +59,12 @@ void printf_wrapper(void *env, const char *fmt, ...) {
}
void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
#if !NDEBUG
if (o_in == NULL) {
print(env, "(nil)");
return;
}
#endif
mp_obj_type_t *type = mp_obj_get_type(o_in);
if (type->print != NULL) {
type->print(print, env, o_in, kind);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment