about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-06-17 11:30:24 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-06-17 11:30:24 -0700
commit1e76d01d4abc555e0468738516b8a0ea3ad34fdc (patch)
treeb437972b492091ced215ceab07f504c66db1b978
parent94c598179d8f27e8ba69dd734bc2811ad779a1b7 (diff)
downloadmu-1e76d01d4abc555e0468738516b8a0ea3ad34fdc.tar.gz
3059
-rw-r--r--032array.cc12
-rw-r--r--036refcount.cc2
2 files changed, 13 insertions, 1 deletions
diff --git a/032array.cc b/032array.cc
index 8d08fdc2..6e583e6d 100644
--- a/032array.cc
+++ b/032array.cc
@@ -128,7 +128,7 @@ container foo [
 :(before "End Load Container Element Definition")
 {
   const type_tree* type = info.elements.back().type;
-  if (type->name == "array") {
+  if (type && type->name == "array") {
     if (!type->right) {
       raise << "container '" << name << "' doesn't specify type of array elements for '" << info.elements.back().name << "'\n" << end();
       continue;
@@ -140,6 +140,16 @@ container foo [
   }
 }
 
+:(scenario code_inside_container)
+container card [
+  rank:number <- next-ingredient
+]
+recipe foo [
+  1:card <- merge 3
+  2:number <- get 1:card rank:offset
+]
+# shouldn't die
+
 //:: To access elements of an array, use 'index'
 
 :(scenario index)
diff --git a/036refcount.cc b/036refcount.cc
index 73ad8928..02af0ab9 100644
--- a/036refcount.cc
+++ b/036refcount.cc
@@ -588,6 +588,7 @@ bool is_mu_container(const reagent& r) {
   return is_mu_container(r.type);
 }
 bool is_mu_container(const type_tree* type) {
+  if (!type) return false;
   if (type->value == 0) return false;
   type_info& info = get(Type, type->value);
   return info.kind == CONTAINER;
@@ -597,6 +598,7 @@ bool is_mu_exclusive_container(const reagent& r) {
   return is_mu_exclusive_container(r.type);
 }
 bool is_mu_exclusive_container(const type_tree* type) {
+  if (!type) return false;
   if (type->value == 0) return false;
   type_info& info = get(Type, type->value);
   return info.kind == EXCLUSIVE_CONTAINER;