mirror of
https://github.com/containers/podman.git
synced 2025-06-23 10:38:20 +08:00
Merge pull request #8030 from Luap99/fix-restore-panic
Fix possible panic in libpod container restore
This commit is contained in:
@ -1024,13 +1024,15 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
|
||||
if !options.IgnoreStaticMAC {
|
||||
// Take the first device with a defined sandbox.
|
||||
var MAC net.HardwareAddr
|
||||
for _, n := range networkStatus[0].Interfaces {
|
||||
if n.Sandbox != "" {
|
||||
MAC, err = net.ParseMAC(n.Mac)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to parse MAC %v", n.Mac)
|
||||
if len(networkStatus) > 0 {
|
||||
for _, n := range networkStatus[0].Interfaces {
|
||||
if n.Sandbox != "" {
|
||||
MAC, err = net.ParseMAC(n.Mac)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to parse MAC %v", n.Mac)
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if MAC != nil {
|
||||
|
Reference in New Issue
Block a user