5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 04:59:38 +08:00

fix: convert js nulls to Go zero values

This commit is contained in:
Lea Anthony 2019-03-19 08:20:45 +11:00
parent 74dbbbed8a
commit c5276cca6c
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -153,8 +153,11 @@ func (b *boundFunction) setInputValue(index int, typ reflect.Type, val interface
}
}()
// Do the conversion
result = reflect.ValueOf(val).Convert(typ)
// Translate javascript null values
if val == nil {
result = reflect.Zero(typ)
} else {
result = reflect.ValueOf(val).Convert(typ)
}
return result, err
}