diff --git a/lib/charms/saml_integrator/v0/saml.py b/lib/charms/saml_integrator/v0/saml.py index 4ed9d99b..13de49aa 100644 --- a/lib/charms/saml_integrator/v0/saml.py +++ b/lib/charms/saml_integrator/v0/saml.py @@ -68,7 +68,7 @@ class method `from_relation_data`. # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 7 +LIBPATCH = 8 # pylint: disable=wrong-import-position import re @@ -297,10 +297,8 @@ def get_relation_data(self) -> typing.Optional[SamlRelationData]: SmtpRelationData: the relation data. """ relation = self.model.get_relation(self.relation_name) - if not relation: + if not relation or not relation.app or not relation.data[relation.app]: return None - assert relation.data - assert relation.app return SamlRelationData.from_relation_data(relation.data[relation.app])