From 138572095cfd92e44718f1d7cd043dee8f96bbff Mon Sep 17 00:00:00 2001 From: UncleGedd <42304551+UncleGedd@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:16:40 -0500 Subject: [PATCH] fix: nil check pkg components in TUI (#538) --- src/pkg/bundle/tui/deploy/handlers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pkg/bundle/tui/deploy/handlers.go b/src/pkg/bundle/tui/deploy/handlers.go index 64ee5795..ae7b06b1 100644 --- a/src/pkg/bundle/tui/deploy/handlers.go +++ b/src/pkg/bundle/tui/deploy/handlers.go @@ -173,7 +173,9 @@ func (m *Model) handleDeployTick() (tea.Model, tea.Cmd) { // check component progress for j := range deployedPkg.DeployedComponents { // check numComponents bc there is a slight delay between rendering the TUI and updating this value - if p.numComponents > 0 && deployedPkg.DeployedComponents[j].Status == zarfTypes.ComponentStatusSucceeded { + // also nil check the componentStatuses to avoid panic + componentSucceeded := deployedPkg.DeployedComponents[j].Status == zarfTypes.ComponentStatusSucceeded + if p.numComponents > 0 && len(p.componentStatuses) >= j && componentSucceeded { m.packages[i].componentStatuses[j] = true } }