posint get_value() : ignore invalid digits

This commit is contained in:
Michael Sippel 2024-09-02 00:07:57 +02:00
parent 9b5dfc9cca
commit 689ac95486
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -35,9 +35,11 @@ pub trait PositionalUInt : SequenceView<Item = u64> {
let mut val = 0; let mut val = 0;
let mut r = 1; let mut r = 1;
for i in 0..self.len().unwrap_or(0) { for i in 0..self.len().unwrap_or(0) {
val += r * self.get(&i).unwrap(); if let Some(digit_val) = self.get(&i) {
val += r * digit_val;
r *= self.get_radix(); r *= self.get_radix();
} }
}
val val
} }