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,8 +35,10 @@ 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();
|
||||
r *= self.get_radix();
|
||||
if let Some(digit_val) = self.get(&i) {
|
||||
val += r * digit_val;
|
||||
r *= self.get_radix();
|
||||
}
|
||||
}
|
||||
|
||||
val
|
||||
|
|
Loading…
Reference in a new issue