mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
fix: avoid crashing on non-numeric input in fan curve editor
This commit is contained in:
parent
48c4a8a102
commit
fe0f8b5e52
@ -34,7 +34,7 @@ impl PointAdjustment {
|
|||||||
temperature_selector.connect_input(|spin| {
|
temperature_selector.connect_input(|spin| {
|
||||||
let text = spin.text();
|
let text = spin.text();
|
||||||
let temp = text.trim_end_matches("°C");
|
let temp = text.trim_end_matches("°C");
|
||||||
Some(Ok(temp.parse::<f64>().unwrap()))
|
Some(Ok(temp.parse::<f64>().unwrap_or_else(|_| spin.value())))
|
||||||
});
|
});
|
||||||
temperature_selector.connect_output(|spin| {
|
temperature_selector.connect_output(|spin| {
|
||||||
let text = format!("{}°C", spin.value_as_int());
|
let text = format!("{}°C", spin.value_as_int());
|
||||||
@ -45,7 +45,10 @@ impl PointAdjustment {
|
|||||||
ratio_selector.connect_input(|spin| {
|
ratio_selector.connect_input(|spin| {
|
||||||
let text = spin.text();
|
let text = spin.text();
|
||||||
let percentage = text.trim_end_matches('%');
|
let percentage = text.trim_end_matches('%');
|
||||||
Some(Ok(percentage.parse::<f64>().unwrap() / 100.0))
|
Some(Ok(percentage
|
||||||
|
.parse::<f64>()
|
||||||
|
.map(|value| value / 100.0)
|
||||||
|
.unwrap_or_else(|_| spin.value())))
|
||||||
});
|
});
|
||||||
ratio_selector.connect_output(|spin| {
|
ratio_selector.connect_output(|spin| {
|
||||||
let value = spin.value();
|
let value = spin.value();
|
||||||
|
Loading…
Reference in New Issue
Block a user