diff --git a/cli/printer/mql.go b/cli/printer/mql.go index 2c99bb3ed1..4594070f64 100644 --- a/cli/printer/mql.go +++ b/cli/printer/mql.go @@ -449,6 +449,10 @@ func (print *Printer) autoExpand(blockRef uint64, data interface{}, bundle *llx. return res.String() } + if data == nil { + return print.Secondary("null") + } + m, ok := data.(map[string]interface{}) if !ok { return "data is not a map to auto-expand" diff --git a/providers-sdk/v1/plugin/runtime.go b/providers-sdk/v1/plugin/runtime.go index dde30074f2..e8e98887e3 100644 --- a/providers-sdk/v1/plugin/runtime.go +++ b/providers-sdk/v1/plugin/runtime.go @@ -170,13 +170,16 @@ func (x *TValue[T]) ToDataRes(typ types.Type) *DataRes { return &DataRes{} } if x.State&StateIsNull != 0 { - res := &DataRes{ - Data: &llx.Primitive{Type: string(typ)}, - } if x.Error != nil { - res.Error = x.Error.Error() + return &DataRes{ + Error: x.Error.Error(), + Data: &llx.Primitive{Type: string(typ)}, + } + } + + return &DataRes{ + Data: &llx.Primitive{Type: string(types.Nil)}, } - return res } raw := llx.RawData{Type: typ, Value: x.Data, Error: x.Error} res := raw.Result()