From 86d055849c7fe9b45bec16c6d20eb7e76de81097 Mon Sep 17 00:00:00 2001 From: Michael Krasnitski Date: Wed, 21 Feb 2024 18:41:48 -0500 Subject: Account for zero-length operand lists --- rust/src/operand_iter.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'rust/src') diff --git a/rust/src/operand_iter.rs b/rust/src/operand_iter.rs index a9b3c753..ba2bce7c 100644 --- a/rust/src/operand_iter.rs +++ b/rust/src/operand_iter.rs @@ -45,6 +45,8 @@ impl Iterator for OperandIter { if let Some(item) = self.current_iter.next() { self.remaining -= 1; Some(item) + } else if self.remaining == 0 { + None // Only reached if initial length is 0 } else { // Will short-circuit and return `None` once iter is exhausted let iter_idx = self.next_iter_idx?; -- cgit v1.3.1