posint get_value() : ignore invalid digits
This commit is contained in:
parent
9b5dfc9cca
commit
689ac95486
1 changed files with 4 additions and 2 deletions
|
@ -35,9 +35,11 @@ pub trait PositionalUInt : SequenceView<Item = u64> {
|
|||
let mut val = 0;
|
||||
let mut r = 1;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
val
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue