Convert None to Void correctly

This commit is contained in:
Simon Hausmann 2023-12-14 00:07:58 +01:00 committed by Simon Hausmann
parent 82c2728cfd
commit 08461d7b32
2 changed files with 8 additions and 0 deletions

View file

@ -39,6 +39,10 @@ impl ToPyObject for PyValue {
impl FromPyObject<'_> for PyValue {
fn extract(ob: &PyAny) -> PyResult<Self> {
if ob.is_none() {
return Ok(slint_interpreter::Value::Void.into());
}
Ok(PyValue(
ob.extract::<bool>()
.map(|b| slint_interpreter::Value::Bool(b))