mirror of https://github.com/containers/podman.git
Merge pull request #24578 from Luap99/addHosts-nil-deref
libpod: addHosts() prevent nil deref
This commit is contained in:
commit
e1951772c5
|
@ -2322,7 +2322,7 @@ func (c *Container) addHosts() error {
|
|||
// not be routed to the host.
|
||||
// https://github.com/containers/podman/issues/22653
|
||||
info, err := c.runtime.network.RootlessNetnsInfo()
|
||||
if err == nil {
|
||||
if err == nil && info != nil {
|
||||
exclude = info.IPAddresses
|
||||
if len(info.MapGuestIps) > 0 {
|
||||
// we used --map-guest-addr to setup pasta so prefer this address
|
||||
|
|
|
@ -624,7 +624,7 @@ func (c *Container) addSpecialDNS(nameservers []string) []string {
|
|||
switch {
|
||||
case c.config.NetMode.IsBridge():
|
||||
info, err := c.runtime.network.RootlessNetnsInfo()
|
||||
if err == nil {
|
||||
if err == nil && info != nil {
|
||||
nameservers = append(nameservers, info.DnsForwardIps...)
|
||||
}
|
||||
case c.pastaResult != nil:
|
||||
|
|
Loading…
Reference in New Issue