mirror of
https://github.com/niusmallnan/steve.git
synced 2025-07-04 18:26:18 +00:00
Check for nil interface value
This commit is contained in:
parent
420f62f642
commit
ccc92e7b19
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@ -65,7 +66,7 @@ func decodeParams(apiOp *types.APIRequest, target runtime.Object) error {
|
||||
}
|
||||
|
||||
func toAPI(schema *types.APISchema, obj runtime.Object) types.APIObject {
|
||||
if obj == nil {
|
||||
if obj == nil || reflect.ValueOf(obj).IsNil() {
|
||||
return types.APIObject{}
|
||||
}
|
||||
|
||||
@ -141,6 +142,9 @@ func moveToUnderscore(obj *unstructured.Unstructured) *unstructured.Unstructured
|
||||
}
|
||||
|
||||
func rowToObject(obj *unstructured.Unstructured) {
|
||||
if obj == nil {
|
||||
return
|
||||
}
|
||||
if obj.Object["kind"] != "Table" ||
|
||||
obj.Object["apiVersion"] != "meta.k8s.io/v1" {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user