Skip to content

Commit 2617fe8

Browse files
committed
fix panic where version not found in pod dep tree
1 parent bdfcc88 commit 2617fe8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sca/bom/buildinfo/technologies/cocoapods/cocoapods.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ func GetPodDependenciesGraph(data string) (map[string][]string, map[string]strin
142142
if len(mainDepMatch) == 3 {
143143
versionMatch := versionRegex.FindStringSubmatch(line)
144144
currentMainDep = mainDepMatch[1]
145-
_, ok := dependencyMap[currentMainDep]
146-
if !ok {
145+
if _, ok := dependencyMap[currentMainDep]; !ok && len(versionMatch) > 1 {
146+
// New dependency with version found
147147
dependencyMap[currentMainDep] = []string{}
148148
versionMap[currentMainDep] = versionMatch[1]
149149
}

0 commit comments

Comments
 (0)