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

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
}