aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bas.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/bas.c b/bas.c
index efb985e..13385f1 100644
--- a/bas.c
+++ b/bas.c
@@ -171,15 +171,19 @@ int vntable_ok(void) {
/* first pass: bad = 1 if all the bytes in the table have the same
value, no matter what it is. */
vp = vnstart + 1;
- bad = 1;
- while(vp < vvstart - 1) {
- if(program[vp] != program[vnstart]) {
- bad = 0;
- break;
+
+ /* don't do this check if the table is only one byte long! */
+ if(vp < vvstart - 1) {
+ bad = 1;
+ while(vp < vvstart - 1) {
+ if(program[vp] != program[vnstart]) {
+ bad = 0;
+ break;
+ }
+ vp++;
}
- vp++;
+ if(bad) return 0;
}
- if(bad) return 0;
/* 2nd pass: bad = 1 if there's any invalid character in the table. */
vp = vnstart;