nil check

This commit is contained in:
Kwitsch 2024-04-22 19:54:29 +00:00
parent c7986899b8
commit f8093f30d8
1 changed files with 6 additions and 1 deletions

View File

@ -287,9 +287,14 @@ func convertMessage[T util.TTLInput](ttl T, key string, message []byte) (CacheEn
Entry: message,
}
packErr := fmt.Errorf("invalid message for key %s", key)
if len(message) == 0 {
return res, packErr
}
var msg *dns.Msg
if err := msg.Unpack(message); err != nil {
return res, fmt.Errorf("invalid message for key %s", key)
return res, packErr
}
if ttl == 0 {