mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
more safeguard for invalid containers
This commit is contained in:
parent
373df56254
commit
b6d3ddc1c8
2 changed files with 18 additions and 13 deletions
|
|
@ -372,14 +372,14 @@ class LoaderController(BackendLoaderController, FrontendLoaderController):
|
|||
|
||||
repre_ids = set()
|
||||
for container in containers:
|
||||
repre_id = container.get("representation")
|
||||
# Ignore invalid representation ids.
|
||||
# - invalid representation ids may be available if e.g. is
|
||||
# opened scene from OpenPype whe 'ObjectId' was used instead
|
||||
# of 'uuid'.
|
||||
# NOTE: Server call would crash if there is any invalid id.
|
||||
# That would cause crash we won't get any information.
|
||||
try:
|
||||
repre_id = container.get("representation")
|
||||
# Ignore invalid representation ids.
|
||||
# - invalid representation ids may be available if e.g. is
|
||||
# opened scene from OpenPype whe 'ObjectId' was used instead
|
||||
# of 'uuid'.
|
||||
# NOTE: Server call would crash if there is any invalid id.
|
||||
# That would cause crash we won't get any information.
|
||||
uuid.UUID(repre_id)
|
||||
repre_ids.add(repre_id)
|
||||
except (ValueError, TypeError, AttributeError):
|
||||
|
|
|
|||
|
|
@ -350,12 +350,14 @@ class ContainersModel:
|
|||
return
|
||||
|
||||
host = self._controller.get_host()
|
||||
if isinstance(host, ILoadHost):
|
||||
containers = list(host.get_containers())
|
||||
elif hasattr(host, "ls"):
|
||||
containers = list(host.ls())
|
||||
else:
|
||||
containers = []
|
||||
containers = []
|
||||
try:
|
||||
if isinstance(host, ILoadHost):
|
||||
containers = list(host.get_containers())
|
||||
elif hasattr(host, "ls"):
|
||||
containers = list(host.ls())
|
||||
except Exception:
|
||||
self._log.error("Failed to get containers", exc_info=True)
|
||||
|
||||
container_items = []
|
||||
containers_by_id = {}
|
||||
|
|
@ -363,6 +365,9 @@ class ContainersModel:
|
|||
invalid_ids_mapping = {}
|
||||
current_project_name = self._controller.get_current_project_name()
|
||||
for container in containers:
|
||||
if not container:
|
||||
continue
|
||||
|
||||
try:
|
||||
item = ContainerItem.from_container_data(
|
||||
current_project_name, container)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue