summary refs log tree commit diff stats
path: root/compiler/vm.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r--compiler/vm.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 7f0dd80ed..373a64e39 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -533,8 +533,10 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       let s = regs[rb].node.strVal
       if s.isNil:
         stackTrace(c, tos, pc, errNilAccess)
-      elif idx <=% s.len:
+      elif idx <% s.len:
         regs[ra].intVal = s[idx].ord
+      elif idx == s.len and optLaxStrings in c.config.options:
+        regs[ra].intVal = 0
       else:
         stackTrace(c, tos, pc, errIndexOutOfBounds)
     of opcWrArr: