posint get_value() : ignore invalid digits
This commit is contained in:
parent
3ec8164202
commit
ff80a0cba0
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