tools: Fix assert when all file contents are excluded (see #3836)

The full contents of a file may be excluded at certain API versions.
This commit is contained in:
Marshall Greenblatt
2025-03-07 11:58:39 -05:00
parent e44a93551f
commit 40fef43488

View File

@ -343,8 +343,9 @@ class CefApiHasher:
else:
content_objects = self.file_content_objs.get(filename, None)
assert content_objects, f'content_objects is None for {filename}'
objects.extend(content_objects)
# May be None if the full contents of the file are excluded at certain API versions.
if not content_objects is None:
objects.extend(content_objects)
# objects will be sorted including filename to make stable hashes
objects = sorted(objects, key=lambda o: f"{o['name']}@{o['filename']}")