aboutsummaryrefslogtreecommitdiff
path: root/object.go
diff options
context:
space:
mode:
Diffstat (limited to 'object.go')
-rw-r--r--object.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/object.go b/object.go
index 93d48e3..f7a11fb 100644
--- a/object.go
+++ b/object.go
@@ -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
}