diff --git a/caching_tag.go b/caching_tag.go index b7ae850..47725da 100644 --- a/caching_tag.go +++ b/caching_tag.go @@ -118,9 +118,13 @@ func (c *cachingTagVisitor) collectTypeKeyTags(path []string, data interface{}, c.collectTypeKeyTags(path, item, typeName) } case map[string]interface{}: - c.addTagForTypeKey(at, v[at], typeName) + if v[at] != nil { + c.addTagForTypeKey(at, v[at], typeName) + } default: - c.Walker.StopWithInternalErr(fmt.Errorf("invalid data type expected map or array map but got %T", v)) + if v != nil { + c.Walker.StopWithInternalErr(fmt.Errorf("invalid data type expected map or array map but got %T", v)) + } } }