From 7e85afab0ed169ee46101246dff0a5d44d8e8b87 Mon Sep 17 00:00:00 2001 From: Pragyesh Mishra Date: Mon, 28 Apr 2025 07:04:47 +0000 Subject: [PATCH] [fix]: [AH-1271]: fixed panic when we call this method with error or other types as input (#3737) * [fix]: [AH-1271]: fixed panic when we call this method with error or values types as input * [fix]: [AH-1271]: fixed panic when we call this method with error or values types as input --- registry/app/pkg/commons/request.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/registry/app/pkg/commons/request.go b/registry/app/pkg/commons/request.go index 204f08960..9eadd20d2 100644 --- a/registry/app/pkg/commons/request.go +++ b/registry/app/pkg/commons/request.go @@ -48,10 +48,13 @@ func IsEmpty(slice interface{}) bool { return true } - if val.Kind() == reflect.Struct { - return false + kind := val.Kind() + + if kind == reflect.Slice || kind == reflect.Array || kind == reflect.Map || kind == reflect.String || + kind == reflect.Chan || kind == reflect.Ptr { + return val.Len() == 0 } - return val.Len() == 0 + return false } func IsEmptyError(err errcode.Error) bool {