about summary refs log tree commit diff stats
path: root/030container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-08 10:31:48 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-11-08 10:31:48 -0800
commit4ecab1821ed7609d35f2c9509cb045dc79606e8c (patch)
treec5f7f3641fd24fac4c36139a81fcddd4dab188e5 /030container.cc
parentf4647409b5fa658e463424c0a8249a4d72405d59 (diff)
downloadmu-4ecab1821ed7609d35f2c9509cb045dc79606e8c.tar.gz
3653
Don't crash on bad types.

I need to be more careful in distinguishing between the two causes of
constraint violations: bad input and internal bugs. Maybe I should
create a second assert() to indicate "this shouldn't really be an
assert, but I'm too lazy to think about it right now."
Diffstat (limited to '030container.cc')
-rw-r--r--030container.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/030container.cc b/030container.cc
index 53efc857..098c38c5 100644
--- a/030container.cc
+++ b/030container.cc
@@ -204,7 +204,10 @@ void compute_container_sizes(const type_tree* type, set<type_tree>& pending_meta
   if (contains_key(pending_metadata, *type)) return;
   pending_metadata.insert(*type);
   if (!type->atom) {
-    assert(type->left->atom);
+    if (!type->left->atom) {
+      raise << "invalid type " << to_string(type) << location_for_error_messages << '\n' << end();
+      return;
+    }
     if (type->left->name == "address")
       compute_container_sizes(type->right, pending_metadata, location_for_error_messages);
     // End compute_container_sizes Non-atom Special-cases