aboutsummaryrefslogtreecommitdiff
path: root/vm.d
diff options
context:
space:
mode:
authormryouse2023-05-27 01:48:18 +0000
committermryouse2023-05-27 01:48:18 +0000
commitea424bbc160ba84c4069a2889689be8685d35a1d (patch)
treea4e829437d99e94a9dcdb8b6f8f9ce1632157192 /vm.d
parent334eafaff25014b0326b2b42e62e9b4f486736e6 (diff)
fix empty (list)
Diffstat (limited to 'vm.d')
-rw-r--r--vm.d8
1 files changed, 5 insertions, 3 deletions
diff --git a/vm.d b/vm.d
index d4fab80..68a148e 100644
--- a/vm.d
+++ b/vm.d
@@ -396,9 +396,11 @@ class VM {
case OpCode.OP_LIST:
int length = to!int(this.readByte());
List lst = new List(length);
- for (int i = length - 1; i >= 0; i--) {
- //lst.appendItem(this.popA());
- lst.addItemAtIndex(this.popA(), i);
+ if (length > 0) {
+ for (int i = length - 1; i >= 0; i--) {
+ //lst.appendItem(this.popA());
+ lst.addItemAtIndex(this.popA(), i);
+ }
}
this.pushA(makeSeqValue(lst));
break;