From f1f834b8fe59a31edb9e5271e2c4cdb504ea2c97 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Wed, 21 Oct 2020 13:33:54 -0700 Subject: [PATCH] commhostport isn't present if communicator is null; protect casting in a check --- builder/qemu/step_run.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index 37a5daf5a..8fe59f6dc 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -282,7 +282,10 @@ func (s *stepRun) applyUserOverrides(defaultArgs map[string]interface{}, config if len(config.QemuArgs) > 0 { s.ui.Say("Overriding default Qemu arguments with qemuargs template option...") - commHostPort := state.Get("commHostPort").(int) + commHostPort := 0 + if config.CommConfig.Comm.Type != "none" { + commHostPort = state.Get("commHostPort").(int) + } httpIp := state.Get("http_ip").(string) httpPort := state.Get("http_port").(int)