Skip to content

fix(docx): guard against None oMath element in malformed equations (fixes #1979)#1987

Open
hanhan761 wants to merge 1 commit into
microsoft:mainfrom
hanhan761:fix-1979-docx-omath-none
Open

fix(docx): guard against None oMath element in malformed equations (fixes #1979)#1987
hanhan761 wants to merge 1 commit into
microsoft:mainfrom
hanhan761:fix-1979-docx-omath-none

Conversation

@hanhan761
Copy link
Copy Markdown

Summary

Fix DOCX math converter crash when an equation element has no valid \oMath\ child (malformed OMML).

Changes

  • Added None guard in _convert_omath_to_latex()\ in \converter_utils/docx/pre_process.py\
  • When \math_root.find()\ returns None, returns empty string instead of crashing

Issue

Fixes #1979

Verification

Code review: the 3-line guard matches the proposed fix in the issue.

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 when oMath element is missing in malformed equations

1 participant