Skip to content

Commit b7fa38e

Browse files
committed
fix: missing check for Classifiers in Environment Parser
Signed-off-by: Paul Horton <[email protected]>
1 parent d45f75b commit b7fa38e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cyclonedx/parser/environment.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ def __init__(self):
6363
if 'License' in i_metadata.keys() and i_metadata.get('License') != 'UNKNOWN':
6464
c.set_license(license_str=i_metadata.get('License'))
6565

66-
for classifier in i_metadata.get_all('Classifier'):
67-
if str(classifier).startswith('License :: OSI Approved :: '):
68-
c.set_license(license_str=str(classifier).replace('License :: OSI Approved :: ', '').strip())
66+
if 'Classifier' in i_metadata.keys():
67+
for classifier in i_metadata.get_all('Classifier'):
68+
if str(classifier).startswith('License :: OSI Approved :: '):
69+
c.set_license(license_str=str(classifier).replace('License :: OSI Approved :: ', '').strip())
6970

7071
self._components.append(c)
7172

0 commit comments

Comments
 (0)