Skip to content

Commit

Permalink
chore: check for nil value
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickMenoti committed May 16, 2024
1 parent 1964a6f commit 5ae66d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/output/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"reflect"

"github.com/aziontech/azion-cli/pkg/logger"
"github.com/fatih/color"
"github.com/aziontech/tablecli"
"github.com/fatih/color"
)

type DescribeOutput struct {
Expand Down Expand Up @@ -69,13 +69,13 @@ func (c *DescribeOutput) Output() {

func checkPrimitiveType(value any) any {
valueType := reflect.TypeOf(value)
if valueType.Kind() == reflect.Int || valueType.Kind() == reflect.String ||
if valueType != nil && (valueType.Kind() == reflect.Int || valueType.Kind() == reflect.String ||
valueType.Kind() == reflect.Bool || valueType.Kind() == reflect.Float32 ||
valueType.Kind() == reflect.Float64 || valueType.Kind() == reflect.Uint ||
valueType.Kind() == reflect.Uint8 || valueType.Kind() == reflect.Uint16 ||
valueType.Kind() == reflect.Uint32 || valueType.Kind() == reflect.Uint64 ||
valueType.Kind() == reflect.Int8 || valueType.Kind() == reflect.Int16 ||
valueType.Kind() == reflect.Int32 || valueType.Kind() == reflect.Int64 {
valueType.Kind() == reflect.Int32 || valueType.Kind() == reflect.Int64) {
return value
}
jsonValue, _ := json.Marshal(value)
Expand Down

0 comments on commit 5ae66d0

Please sign in to comment.