From 5ee4f1c95237f9794b151cd8fadea7f6e4a8d554 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 16 Apr 2015 16:28:16 -0700 Subject: 1070 --- cpp/030length | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cpp/030length') 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 result; //? cout << "length: " << x.value << '\n'; //? 1 result.push_back(Memory[x.value]); -- cgit 1.4.1-2-gfad0