@@ -153,15 +153,17 @@ def _get_default_style(self, recursive=False):
153
153
return self ._resolve_style (element , recursive ) if element is not None else None
154
154
155
155
def _resolve_style (self , element , recursive = False ):
156
- if ":" in element .find ('name' ).text :
157
- ws_name , style_name = element .find ('name' ).text .split (':' )
158
- else :
159
- style_name = element .find ('name' ).text
160
- ws_name = None
161
- atom_link = [n for n in element if 'href' in n .attrib ]
162
- if atom_link and ws_name is None :
163
- ws_name = workspace_from_url (atom_link [0 ].get ("href" ))
164
- return self .catalog .get_styles (names = style_name , workspaces = ws_name , recursive = recursive )[0 ]
156
+ if element and element .find ('name' ) and element .find ('name' ).text :
157
+ if ":" in element .find ('name' ).text :
158
+ ws_name , style_name = element .find ('name' ).text .split (':' )
159
+ else :
160
+ style_name = element .find ('name' ).text
161
+ ws_name = None
162
+ atom_link = [n for n in element if 'href' in n .attrib ]
163
+ if atom_link and ws_name is None :
164
+ ws_name = workspace_from_url (atom_link [0 ].get ("href" ))
165
+ return self .catalog .get_styles (names = style_name , workspaces = ws_name , recursive = recursive )[0 ]
166
+ return None
165
167
166
168
def _set_default_style (self , style ):
167
169
if isinstance (style , Style ):
0 commit comments