Add nil check when checking setup software (#30520)

Quick nil check + test to check that it works. Test fails with panic on
main, works on this branch.
This commit is contained in:
Scott Gress
2025-07-02 15:27:42 -03:00
committed by GitHub
parent efa265f6b0
commit 95871bffa0
2 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -926,7 +926,8 @@ func (cmd *GenerateGitopsCommand) generateControls(teamId *uint, teamName string
}
hasSetupSoftware := false
for _, software := range setupSoftware {
if software.SoftwarePackage.InstallDuringSetup != nil && *software.SoftwarePackage.InstallDuringSetup {
pkg := software.SoftwarePackage
if pkg != nil && pkg.InstallDuringSetup != nil && *pkg.InstallDuringSetup {
hasSetupSoftware = true
break
}
@@ -420,6 +420,11 @@ func (MockClient) GetSetupExperienceSoftware(teamID uint) ([]fleet.SoftwareTitle
Version: "13.37",
},
},
{
ID: 2,
Name: "My Other Software Package",
HashSHA256: ptr.String("software-package-hash"),
},
}, nil
}
if teamID == 0 || teamID == 3 || teamID == 4 || teamID == 5 {