Guard against word-not-found in sread tokenization

If text.find(word_str, offset) returns -1, use the offset as a fallback.
This commit is contained in:
Jared Miller 2026-02-09 21:46:45 -05:00
parent 28a097997c
commit 1bcb83961a
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -670,6 +670,8 @@ class ZCpu:
word_str, dict_addr = tokens[i]
# Find word position in text
pos = text.find(word_str, offset)
if pos == -1:
pos = offset # fallback: best guess position
word_len = len(word_str)
base = parse_buffer_addr + 2 + (i * 4)
self._memory.write_word(base, dict_addr)