Skip to content

Commit

Permalink
tool: parse u64 correctly
Browse files Browse the repository at this point in the history
Signed-off-by: James Archer <[email protected]>
  • Loading branch information
JE-Archer committed Jul 26, 2024
1 parent 5367c76 commit 18f4f27
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tool/microkit/src/sysxml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,8 @@ impl DomainSchedule {
));
}

let time = checked_lookup(xml_sdf, &child, "length")?
.parse::<i64>()
.unwrap();
if time <= 0 {
let time = checked_lookup(xml_sdf, &child, "length")?.parse::<u64>();
if let Err(_) = time {
return Err(format!(
"Error: invalid domain time '{}': {}",
name,
Expand All @@ -848,7 +846,7 @@ impl DomainSchedule {

domains.push(Domain {
name: name.to_string(),
length: time as u64,
length: time.unwrap(),
});
}

Expand Down

0 comments on commit 18f4f27

Please sign in to comment.