diff options
author | Nadrieril | 2019-03-05 11:56:59 +0100 |
---|---|---|
committer | Nadrieril | 2019-03-05 11:56:59 +0100 |
commit | 4314421924c256ab13f5a630aff2596c480f6a66 (patch) | |
tree | a70233f2d923fbdb9a1aae39699676adc98eac8c | |
parent | b3b3a61a903093cddb1e3835540de7b0d96ae822 (diff) |
Fix in match_iter error handling
-rw-r--r-- | dhall/src/parser.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dhall/src/parser.rs b/dhall/src/parser.rs index 36e1726..6c7c0c5 100644 --- a/dhall/src/parser.rs +++ b/dhall/src/parser.rs @@ -128,7 +128,10 @@ macro_rules! match_iter { // Normal pattern after a variable length one: declare reversed and take from the end (@match $w:expr, $iter:expr, $x:ident $($rest:tt)*) => { match_iter!(@match $w, $iter $($rest)*); - let $x = $iter.next_back().unwrap(); + let $x = match $iter.next_back() { + Some(x) => x, + None => break Err(IterMatchError::NotEnoughItems), + }; }; // Check no elements remain |