5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 06:19:43 +08:00

Merge pull request #66 from wailsapp/handle-javascript-nulls

fix: convert js nulls to Go zero values
This commit is contained in:
Lea Anthony 2019-03-19 08:21:31 +11:00 committed by GitHub
commit 9f5e2c7dd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}