diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-29 18:40:36 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-29 18:40:36 -0700 |
commit | 89b87bc7c493670ecb598784e1073a09f691d43e (patch) | |
tree | b645853bb524a9a57a897a729269786aad8c4ce6 /064random.cc | |
parent | 9570363aec35e187e2395b1760a4b94e71580ac9 (diff) | |
download | mu-89b87bc7c493670ecb598784e1073a09f691d43e.tar.gz |
1886 - gracefully handle malformed ingredients
For example: x:number <- index y:address:array:number, 3 (forgetting to do a lookup) Thanks Caleb Couch.
Diffstat (limited to '064random.cc')
-rw-r--r-- | 064random.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/064random.cc b/064random.cc index bd171132..cdc519c9 100644 --- a/064random.cc +++ b/064random.cc @@ -27,6 +27,7 @@ ROUND, Recipe_ordinal["round"] = ROUND; :(before "End Primitive Recipe Implementations") case ROUND: { + products.resize(1); if (SIZE(ingredients) != 1) { raise << current_recipe_name() << ": 'round' requires exactly one ingredient, but got " << current_instruction().to_string() << '\n' << end(); break; @@ -35,7 +36,6 @@ case ROUND: { raise << current_recipe_name() << ": first ingredient of 'round' should be a number, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end(); break; } - products.resize(1); products.at(0).push_back(rint(ingredients.at(0).at(0))); break; } |