fix: Handle missing runs to avoid out of range exception (#1844)

Fixes #1681 on upstream

Signed-off-by: Allen Nikka <allennikka@gmail.com>
This commit is contained in:
Allen N. 2025-06-24 22:55:27 -07:00 committed by GitHub
parent 1dc63d0aa9
commit 4002de1f92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -397,7 +397,11 @@ class MsWordDocumentBackend(DeclarativeDocumentBackend):
if isinstance(c, Hyperlink):
text = c.text
hyperlink = Path(c.address)
format = self._get_format_from_run(c.runs[0])
format = (
self._get_format_from_run(c.runs[0])
if c.runs and len(c.runs) > 0
else None
)
elif isinstance(c, Run):
text = c.text
hyperlink = None