From a00abf526c7fe3c68a9804ef43d6208ebc74d939 Mon Sep 17 00:00:00 2001 From: Nick Barrett Date: Thu, 11 Feb 2016 14:55:45 +0000 Subject: [PATCH] Fix case where text is None. --- src/onelogin/saml2/response.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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']):