Skip to content

fix: prevent docx math converter crash on math run elements with no text child (#2188)#2195

Open
Ruanyuxi1337 wants to merge 1 commit into
microsoft:mainfrom
Ruanyuxi1337:fix-docx-math-no-text
Open

fix: prevent docx math converter crash on math run elements with no text child (#2188)#2195
Ruanyuxi1337 wants to merge 1 commit into
microsoft:mainfrom
Ruanyuxi1337:fix-docx-math-no-text

Conversation

@Ruanyuxi1337

Copy link
Copy Markdown

Fixes #2188.

In do_r() inside omml.py, iterating over elm.findtext(./{0}t.format(OMML_NS)) can crash with TypeError: 'NoneType' object is not iterable if there is a math run element (<m:r>) with no text child (<m:t>). This PR fixes it by using a fallback default of an empty string (elm.findtext(...) or "").

A regression test is included.

@Ruanyuxi1337

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: DOCX math converter crashes (and silently drops all equations) when a math run has no text child

1 participant