mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 21:10:54 +08:00
Add argument guard for methods
This commit is contained in:
parent
ceaacc7ba9
commit
7573f68df3
@ -30,6 +30,9 @@ func (b *BoundMethod) OutputCount() int {
|
||||
func (b *BoundMethod) ParseArgs(args []json.RawMessage) ([]interface{}, error) {
|
||||
|
||||
result := make([]interface{}, b.InputCount())
|
||||
if len(args) != b.InputCount() {
|
||||
return nil, fmt.Errorf("received %d arguments to method '%s', expected %d", len(args), b.Name, b.InputCount())
|
||||
}
|
||||
for index, arg := range args {
|
||||
typ := b.Inputs[index].reflectType
|
||||
inputValue := reflect.New(typ).Interface()
|
||||
|
Loading…
Reference in New Issue
Block a user