about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-06 18:49:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-06 18:49:56 -0700
commit75aa3a98e2b9311d65df91523ec754d5a2770456 (patch)
treed6768c228e603871c2ca5861797e8017fc3069f6
parent8ec12cbe80d146c3846602c6d8945683d752e9eb (diff)
downloadmu-75aa3a98e2b9311d65df91523ec754d5a2770456.tar.gz
2257
-rw-r--r--035call_ingredient.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/035call_ingredient.cc b/035call_ingredient.cc
index 3772c644..fd8e7508 100644
--- a/035call_ingredient.cc
+++ b/035call_ingredient.cc
@@ -56,8 +56,13 @@ case NEXT_INGREDIENT: {
   else {
     if (SIZE(current_instruction().products) < 2)
       raise << maybe(current_recipe_name()) << "no ingredient to save in " << current_instruction().products.at(0).original_string << '\n' << end();
+    if (current_instruction().products.empty()) break;
     products.resize(2);
-    products.at(0).push_back(0);  // todo: will fail noisily if we try to read a compound value
+    // pad the first product with sufficient zeros to match its type
+    long long int size = size_of(current_instruction().products.at(0));
+    for (long long int i = 0; i < size; ++i) {
+      products.at(0).push_back(0);
+    }
     products.at(1).push_back(0);
   }
   break;