From a4140a673b37a8d6aa485e7cf6488faac4c030f5 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Fri, 28 Jun 2024 17:24:33 -0400 Subject: [PATCH] fix XRayDiffractionComponent AttributeError NoneType has no attribute sites in self.from_data(structure).sites --- crystal_toolkit/components/diffraction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crystal_toolkit/components/diffraction.py b/crystal_toolkit/components/diffraction.py index 64d74e78..1696106a 100644 --- a/crystal_toolkit/components/diffraction.py +++ b/crystal_toolkit/components/diffraction.py @@ -503,8 +503,8 @@ def pattern_from_struct(struct, rad_source): Output(self.id("large_cell_note"), "children"), Input(self.id("structure"), "data"), ) - def update_message(structure): - if len(self.from_data(structure).sites) < SITES_LIMIT: + def update_message(structure: Structure | None): + if structure is None or len(self.from_data(structure).sites) < SITES_LIMIT: return html.Div([]) return MessageContainer( MessageBody(