summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dhall/src/parser.rs5
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