Skip to content

Commit 5307407

Browse files
committed
fix indexes_as_range
1 parent 4680d8d commit 5307407

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

svd-rs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## Unreleased
99

10+
- Fix `indexes_as_range`
11+
1012
## [v0.14.3] - 2023-04-04
1113

1214
- Bump MSRV to 1.58.0

svd-rs/src/dimelement.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ impl DimElement {
170170
pub fn indexes_as_range(&self) -> Option<RangeInclusive<u32>> {
171171
let mut integers = Vec::with_capacity(self.dim as usize);
172172
for idx in self.indexes() {
173-
integers.push(idx.parse::<u32>().ok()?);
173+
let val = idx.parse::<u32>().ok()?;
174+
if val.to_string() != idx {
175+
return None;
176+
}
177+
integers.push(val);
174178
}
175179
let min = *integers.iter().min()?;
176180
let max = *integers.iter().max()?;

0 commit comments

Comments
 (0)