diff --git a/pathfind.go b/pathfind.go index 3b23e8ea3687f960ebe0cdb1e56e677e20f0aa8d..4c19075d33aefc0fefbfa46044067e54fc8b0321 100644 --- a/pathfind.go +++ b/pathfind.go @@ -26,6 +26,10 @@ func getValueFrom[D any](obj D, keyWithDots string) (interface{}, error) { v = v.FieldByName(key) } + if v.Kind() == reflect.Invalid { + return nil, newInvalidPathError(keyWithDots) + } + for v.Kind() == reflect.Ptr { v = v.Elem() }