fix: parse errors correctly

Message metadata might be missing, the easiest usecase is contacting
worker directly using it both as an endpoint and a node.

Fixes #7108

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Andrey Smirnov 2023-04-19 17:08:36 +04:00
parent 374ef53853
commit 7a004a6f7f
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD

View File

@ -38,7 +38,7 @@ func CheckErrors[T interface{ GetMetadata() *common.Metadata }](messages ...T) e
for _, msg := range messages {
md := msg.GetMetadata()
if md.Error != "" {
if md != nil && md.Error != "" {
err = AppendErrors(err, fmt.Errorf(md.Error))
}
}