fix in ooc Strings modules to prevent index out of range error.

This commit is contained in:
Norayr Chilingarian 2022-03-15 17:20:41 +04:00
parent bc8adf76c1
commit 32ec67552f
2 changed files with 11 additions and 2 deletions

View file

@ -63,7 +63,11 @@ PROCEDURE Length* (stringVal: ARRAY OF CHAR): INTEGER;
i: INTEGER;
BEGIN
i := 0;
WHILE (stringVal[i] # 0X) DO
(* note from noch:
original ooc code below, commented out, leads to
index out of range runtime error
WHILE (stringVal[i] # 0X) DO *)
WHILE ((i < LEN(stringVal)) & (stringVal[i] # 0X)) DO
INC (i)
END;
RETURN i