diff options
author | Marius Orcsik | 2022-06-04 19:19:30 +0200 |
---|---|---|
committer | Marius Orcsik | 2022-06-04 19:19:30 +0200 |
commit | 697681d8d45628270e5742b66730eef1c65ee07a (patch) | |
tree | c36a49712e4772d81592d8fc795226aeabc2baff /object.go | |
parent | 6917e06269f57792ea1ad6ea79556cc772df48eb (diff) |
Added benchmarks for 'ToXX' vs 'To[T type]'
They show some weird numbers considering the 'On' benchmarks
Diffstat (limited to 'object.go')
-rw-r--r-- | object.go | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -676,6 +676,9 @@ func ToObject(it Item) (*Object, error) { // NOTE(marius): this is an ugly way of dealing with the interface conversion error: types from different scopes typ := reflect.TypeOf(new(Object)) if reflect.TypeOf(it).ConvertibleTo(typ) { + if reflect.ValueOf(it).IsNil() { + return nil, nil + } if i, ok := reflect.ValueOf(it).Convert(typ).Interface().(*Object); ok { return i, nil } |