about summary refs log tree commit diff stats
path: root/042name.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-17 11:25:00 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-17 11:25:00 -0800
commitc6354606d412b7719ab7078b59c015d580520bde (patch)
tree850da3f23f90b7680fe3dca4f1017c9dc9615c3d /042name.cc
parent5729eb517bd6bdbfb08ec95d04d3e3baf22e81b8 (diff)
downloadmu-c6354606d412b7719ab7078b59c015d580520bde.tar.gz
2456
Diffstat (limited to '042name.cc')
-rw-r--r--042name.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/042name.cc b/042name.cc
index b25ca533..e9812624 100644
--- a/042name.cc
+++ b/042name.cc
@@ -204,8 +204,10 @@ if (inst.name == "get" || inst.name == "get-address") {
   if (inst.ingredients.at(1).name.find_first_not_of("0123456789") != string::npos) {
     // since first non-address in base type must be a container, we don't have to canonize
     type_ordinal base_type = skip_addresses(inst.ingredients.at(0).type, get(Recipe, r).name);
-    inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name));
-    trace(9993, "name") << "element " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " is at offset " << no_scientific(inst.ingredients.at(1).value) << end();
+    if (contains_key(Type, base_type)) {  // otherwise we'll raise an error elsewhere
+      inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name));
+      trace(9993, "name") << "element " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " is at offset " << no_scientific(inst.ingredients.at(1).value) << end();
+    }
   }
 }
 
@@ -243,7 +245,9 @@ if (inst.name == "maybe-convert") {
   if (inst.ingredients.at(1).name.find_first_not_of("0123456789") != string::npos) {
     // since first non-address in base type must be an exclusive container, we don't have to canonize
     type_ordinal base_type = skip_addresses(inst.ingredients.at(0).type, get(Recipe, r).name);
-    inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name));
-    trace(9993, "name") << "variant " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " has tag " << no_scientific(inst.ingredients.at(1).value) << end();
+    if (contains_key(Type, base_type)) {  // otherwise we'll raise an error elsewhere
+      inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name));
+      trace(9993, "name") << "variant " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " has tag " << no_scientific(inst.ingredients.at(1).value) << end();
+    }
   }
 }