From 5ee1c8be5ae9055defa1f3ea29cbdf906ea51a52 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sat, 11 Oct 2014 17:07:25 +1100 Subject: [PATCH] oceani: don't try to print a 'then' clause for a switch. 'switch' doesn't have a 'then', so don't try to print it. Signed-off-by: NeilBrown --- csrc/oceani.mdc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index bd2c41a..47d5f8a 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -1814,13 +1814,18 @@ defined. cast(binode, cs->condpart)->op == Block) { printf(":\n"); print_exec(cs->condpart, indent+1, bracket); - do_indent(indent, "then:\n"); - print_exec(cs->thenpart, indent+1, bracket); + if (cs->thenpart) { + do_indent(indent, "then:\n"); + print_exec(cs->thenpart, indent+1, bracket); + } } else { printf(" "); print_exec(cs->condpart, 0, bracket); - printf(":\n"); - print_exec(cs->thenpart, indent+1, bracket); + if (cs->thenpart) { + printf(":\n"); + print_exec(cs->thenpart, indent+1, bracket); + } else + printf("\n"); } } for (cp = cs->casepart; cp; cp = cp->next) { -- 2.43.0