Refactor code to handle missing "representations" key in instance data

The code change modifies the `ExtractThumbnail` class in `extract_thumbnail.py`. It updates the loop that iterates over representations to handle cases where the "representations" key is missing from the instance data. This change ensures that cleanup occurs for representations with both "delete" and "need_thumbnail" tags.
This commit is contained in:
Jakub Jezek 2023-12-07 22:08:19 +01:00
parent 839963915e
commit c4570200ff
No known key found for this signature in database
GPG key ID: 730D7C02726179A7

View file

@ -56,7 +56,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
# Make sure cleanup happens to representations which are having both
# tags `delete` and `need_thumbnail`
for repre in tuple(instance.data["representations"]):
for repre in tuple(instance.data.get("representations", [])):
tags = repre.get("tags") or []
# skip representations which are going to be published on farm
if "publish_on_farm" in tags: