Skip to content

Commit

Permalink
fixed issue that would raise exception in case when a text element ha…
Browse files Browse the repository at this point in the history
…s no styles set.
  • Loading branch information
kienerj committed Jun 3, 2024
1 parent b2d171c commit 0cb554f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pycdxml/cdxml_converter/chemdraw_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,11 @@ def to_element(self, t: ET.Element):
:return: the passed in element with the style elements added
"""
if len(self.style_starts) == 0:
raise TypeError('Call of to_element on CDXString is invalid if no styles are present. '
'If CDXString is part of a property there are no styles.')
# raise TypeError('Call of to_element on CDXString is invalid if no styles are present. '
# 'If CDXString is part of a property there are no styles.')
logger.warning("No style elements (<s>) found for text element (<t>). "
"Returning text element without any added styles.")
return t
for idx, style in enumerate(self.styles):
s = style.to_element()
text_start_index = self.style_starts[idx]
Expand Down

0 comments on commit 0cb554f

Please sign in to comment.