about summary refs log tree commit diff stats
path: root/cpp/030length
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/030length')
-rw-r--r--cpp/030length4
1 files changed, 4 insertions, 0 deletions
diff --git a/cpp/030length b/cpp/030length
index 7b5c52be..b9e3bc3c 100644
--- a/cpp/030length
+++ b/cpp/030length
@@ -18,6 +18,10 @@ Next_recipe_number++;
 :(before "End Primitive Recipe Implementations")
 case LENGTH: {
   reagent x = canonize(instructions[pc].ingredients[0]);
+  if (x.types[0] != Type_number["array"]) {
+    raise << "tried to calculate length of non-array " << x.to_string() << '\n';
+    break;
+  }
   vector<int> result;
 //?   cout << "length: " << x.value << '\n'; //? 1
   result.push_back(Memory[x.value]);