diff --git a/virtcontainers/kata_agent.go b/virtcontainers/kata_agent.go index a57da3a3e6..49cd9149e3 100644 --- a/virtcontainers/kata_agent.go +++ b/virtcontainers/kata_agent.go @@ -672,13 +672,10 @@ func (k *kataAgent) listInterfaces() ([]*vcTypes.Interface, error) { return nil, err } resultInterfaces, ok := resultingInterfaces.(*grpc.Interfaces) - if ok { - ifaces, err := k.convertToInterfaces(resultInterfaces.Interfaces) - if err == nil { - return ifaces, nil - } + if !ok { + return nil, fmt.Errorf("Unexpected type %T for interfaces", resultingInterfaces) } - return nil, err + return k.convertToInterfaces(resultInterfaces.Interfaces) } func (k *kataAgent) listRoutes() ([]*vcTypes.Route, error) {