From 689ac95486208bc6d77174f9d4afb3e6fd6bc8c0 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Mon, 2 Sep 2024 00:07:57 +0200 Subject: [PATCH] posint get_value() : ignore invalid digits --- lib-nested-core/src/editors/integer/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib-nested-core/src/editors/integer/mod.rs b/lib-nested-core/src/editors/integer/mod.rs index b7cd6df..c0d59d4 100644 --- a/lib-nested-core/src/editors/integer/mod.rs +++ b/lib-nested-core/src/editors/integer/mod.rs @@ -35,8 +35,10 @@ pub trait PositionalUInt : SequenceView { let mut val = 0; let mut r = 1; for i in 0..self.len().unwrap_or(0) { - val += r * self.get(&i).unwrap(); - r *= self.get_radix(); + if let Some(digit_val) = self.get(&i) { + val += r * digit_val; + r *= self.get_radix(); + } } val