Merge pull request #19531 from dfr/freebsd-kube

libpod: fix a crash in 'kube generate' on FreeBSD
This commit is contained in:
OpenShift Merge Robot 2023-08-07 11:13:25 +02:00 committed by GitHub
commit e9a3b7cfa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -1210,9 +1210,11 @@ func (c *Container) HostNetwork() bool {
if c.config.CreateNetNS || c.config.NetNsCtr != "" {
return false
}
for _, ns := range c.config.Spec.Linux.Namespaces {
if ns.Type == spec.NetworkNamespace {
return false
if c.config.Spec.Linux != nil {
for _, ns := range c.config.Spec.Linux.Namespaces {
if ns.Type == spec.NetworkNamespace {
return false
}
}
}
return true