Skip to content

Commit

Permalink
#160 Fix track position parsing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Mar 9, 2021
1 parent a2fc4dc commit a051d24
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions main/src/infrastructure/ui/mapping_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,13 +1142,11 @@ impl<'a> MutableMappingPanel<'a> {
VirtualTrackType::ByIndex => {
let position: i32 = control
.text()
.unwrap_or_default()
.parse()
.unwrap_or_default();
self.mapping
.target_model
.track_index
.set(position.max(0) as _);
.ok()
.and_then(|text| text.parse().ok())
.unwrap_or(1);
let index = std::cmp::max(position - 1, 0) as u32;
self.mapping.target_model.track_index.set(index);
}
_ => {}
},
Expand Down

0 comments on commit a051d24

Please sign in to comment.