about summary refs log tree commit diff stats
path: root/cpp/030length
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-16 16:28:16 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-16 16:28:16 -0700
commit5ee4f1c95237f9794b151cd8fadea7f6e4a8d554 (patch)
tree891e5b89452d0f620456c2608a1c1d2e2b40a795 /cpp/030length
parentdb5c9550e972d114aaabb95b14cfd1e3ea185349 (diff)
downloadmu-5ee4f1c95237f9794b151cd8fadea7f6e4a8d554.tar.gz
1070
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]);