aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/indent/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/indent/parse.c')
-rw-r--r--usr.bin/indent/parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/indent/parse.c b/usr.bin/indent/parse.c
index a77019b847487..f6590fd253c26 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 <lbrace> <stmt> or <lbrace> <stmtl> */
- 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;
}