container: check containerInfo.Config before accessing it

check that containerInfo.Config is not nil before trying to access
it.

Closes: https://github.com/containers/libpod/issues/2654

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2019-03-14 21:10:25 +01:00
parent 39859850ae
commit 508e08410b

View File

@ -337,11 +337,13 @@ func (c *Container) setupStorage(ctx context.Context) error {
} }
// Set the default Entrypoint and Command // Set the default Entrypoint and Command
if c.config.Entrypoint == nil { if containerInfo.Config != nil {
c.config.Entrypoint = containerInfo.Config.Config.Entrypoint if c.config.Entrypoint == nil {
} c.config.Entrypoint = containerInfo.Config.Config.Entrypoint
if c.config.Command == nil { }
c.config.Command = containerInfo.Config.Config.Cmd if c.config.Command == nil {
c.config.Command = containerInfo.Config.Config.Cmd
}
} }
artifacts := filepath.Join(c.config.StaticDir, artifactsDir) artifacts := filepath.Join(c.config.StaticDir, artifactsDir)