Skip to content

Commit 28a9d66

Browse files
committed
[Rust] Misc interaction handler fixes
1 parent ec8dfdb commit 28a9d66

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rust/src/interaction/form.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl FormInputField {
135135
let int_default = value.hasDefault.then_some(value.intDefault);
136136
let address_default = value.hasDefault.then_some(value.addressDefault);
137137
let index_default = value.hasDefault.then_some(value.indexDefault);
138-
let bool_default = value.hasDefault.then_some(value.intResult != 0);
138+
let bool_default = int_default.map(|i| i != 0);
139139
let extension = raw_to_string(value.ext);
140140
let current_address = value.currentAddress;
141141
let string_result = raw_to_string(value.stringResult);
@@ -355,6 +355,7 @@ impl FormInputField {
355355
pub fn try_default_int(&self) -> Option<i64> {
356356
match self {
357357
FormInputField::Integer { default, .. } => *default,
358+
FormInputField::Checkbox { default, .. } => default.map(|b| b as i64),
358359
_ => None,
359360
}
360361
}
@@ -391,6 +392,7 @@ impl FormInputField {
391392
pub fn try_value_int(&self) -> Option<i64> {
392393
match self {
393394
FormInputField::Integer { value, .. } => Some(*value),
395+
FormInputField::Checkbox { value, .. } => Some(*value as i64),
394396
_ => None,
395397
}
396398
}

0 commit comments

Comments
 (0)