From 124e8b9db6a2d43ff9577473f264165021498cc9 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Sat, 15 Oct 2022 08:23:53 +0200
Subject: [PATCH] fix invalid type exception

---
 pathfind.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pathfind.go b/pathfind.go
index 3b23e8e..4c19075 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()
 	}
-- 
GitLab