diff --git a/mie/print/op.c b/mie/print/op.c index 5977684..95cd306 100644 --- a/mie/print/op.c +++ b/mie/print/op.c @@ -38,6 +38,10 @@ void mie_printer_print_op_arg( b_stream_write_char(printer->p_stream, '%'); } + if (!arg_name) { + arg_name = ""; + } + b_stream_write_string(printer->p_stream, arg_name, NULL); if (!resolved @@ -62,15 +66,20 @@ void mie_printer_print_op_successor( b_stream_write_char(printer->p_stream, '^'); bool resolved = false; + const char *name = NULL; if (successor->s_flags & MIE_OP_F_SUCCESSOR_RESOLVED) { - b_stream_write_string( - printer->p_stream, successor->s_block->b_name.n_str, NULL); + name = successor->s_block->b_name.n_str; resolved = true; } else { - b_stream_write_string( - printer->p_stream, successor->s_block_name, NULL); + name = successor->s_block_name; } + if (!name) { + name = ""; + } + + b_stream_write_string(printer->p_stream, name, NULL); + if (!resolved && MIE_TEST_FLAGS( printer->p_flags, MIE_PRINT_F_MARK_UNRESOLVED_ELEMENTS)) { diff --git a/mie/print/type.c b/mie/print/type.c index bb5e60c..96fcef1 100644 --- a/mie/print/type.c +++ b/mie/print/type.c @@ -12,6 +12,11 @@ void mie_printer_print_type(struct mie_printer *printer, const struct mie_type *type) { + if (!type) { + b_stream_write_string(printer->p_stream, "", NULL); + return; + } + if (TYPE_HAS_PRINT_CALLBACK(type)) { type->ty_def->ty_print(type, printer); } else if (TYPE_IS_BUILTIN(type)) {