diff --git a/src/onelogin/saml2/response.py b/src/onelogin/saml2/response.py index bfaeee67..41ca5791 100644 --- a/src/onelogin/saml2/response.py +++ b/src/onelogin/saml2/response.py @@ -349,9 +349,10 @@ def get_attributes(self): for attr in attribute_node.iterchildren('{%s}AttributeValue' % OneLogin_Saml2_Constants.NSMAP['saml']): # Remove any whitespace (which may be present where attributes are # nested inside NameID children). - text = attr.text.strip() - if text: - values.append(text) + if attr.text: + text = attr.text.strip() + if text: + values.append(text) # Parse any nested NameID children for nameid in attr.iterchildren('{%s}NameID' % OneLogin_Saml2_Constants.NSMAP['saml']):