diff --git a/usr.bin/indent/parse.c b/usr.bin/indent/parse.c index a77019b84748..f6590fd253c2 100644 --- a/usr.bin/indent/parse.c +++ b/usr.bin/indent/parse.c @@ -172,7 +172,7 @@ parse(int tk) /* tk: the code for the construct scanned */ case rbrace: /* scanned a } */ /* stack should have or */ - if (ps.p_stack[ps.tos - 1] == lbrace) { + if (ps.tos > 0 && ps.p_stack[ps.tos - 1] == lbrace) { ps.ind_level = ps.i_l_follow = ps.il[--ps.tos]; ps.p_stack[ps.tos] = stmt; }