aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-15 14:10:35 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-15 15:36:39 -0400
commitc8a7eb85d06c71a184a7fe5aabd732d0779900cf (patch)
treea02270d0f3eee86199aff545a06ba516d91aba67
parenta13e921b196a2be691af256520877e4020a04f0c (diff)
downloadbw-atari8-tools-c8a7eb85d06c71a184a7fe5aabd732d0779900cf.tar.gz
bas.c: don't get stuck in an infinite loop if soffset == 0.
-rw-r--r--bas.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bas.c b/bas.c
index 6be34f7..ddc424f 100644
--- a/bas.c
+++ b/bas.c
@@ -343,6 +343,10 @@ void walk_code(unsigned int startlineno, unsigned int endlineno) {
pos = linepos + 3;
while(pos < nextpos) { /* loop over statements within a line */
soffset = program[pos];
+ if(!soffset) {
+ fprintf(stderr, "Fatal: next-statement offset is 0 at line %d, pos %04x\n", lineno, pos);
+ exit(1);
+ }
end = linepos + soffset;
CALL(on_start_stmt);