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