fix possible IndexError (#33750)

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24 2024-10-10 11:49:24 +02:00 committed by GitHub
parent 7cd73ef4a7
commit bd27e64cd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -470,7 +470,7 @@ def validate_dependency_licenses():
error_fields = error['fields']
if error['type'] == 'summary':
num_license_errors = error_fields['licenses']['errors']
elif 'graphs' in error_fields:
elif 'graphs' in error_fields and error_fields['graphs']:
crate = error_fields['graphs'][0]['Krate']
license_name = error_fields['notes'][0]
message = f'Rejected license "{license_name}". Run `cargo deny` for more details'