summaryrefslogtreecommitdiffstats
path: root/usr.bin/checknr/checknr.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/checknr/checknr.c')
-rw-r--r--usr.bin/checknr/checknr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/checknr/checknr.c b/usr.bin/checknr/checknr.c
index 01d3216..c150b79 100644
--- a/usr.bin/checknr/checknr.c
+++ b/usr.bin/checknr/checknr.c
@@ -341,7 +341,8 @@ process(FILE *f)
n = 10 * n + line[i] - '0';
i--;
if (n == 0) {
- if (stk[stktop].opno == SZ) {
+ if (stktop >= 0 &&
+ stk[stktop].opno == SZ) {
stktop--;
} else {
pe(lineno);
@@ -356,7 +357,8 @@ process(FILE *f)
} else if (!fflag && line[i] == 'f') {
n = line[++i];
if (n == 'P') {
- if (stk[stktop].opno == FT) {
+ if (stktop >= 0 &&
+ stk[stktop].opno == FT) {
stktop--;
} else {
pe(lineno);
OpenPOWER on IntegriCloud