Fix #1534: Handle None response from LLM in PptxConverter#1569
Open
cobyfrombrooklyn-bot wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix #1534: Handle None response from LLM in PptxConverter#1569cobyfrombrooklyn-bot wants to merge 1 commit intomicrosoft:mainfrom
cobyfrombrooklyn-bot wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When llm_caption() returns None (e.g., LLM returns null content), the join on line 139 raises TypeError because str.join cannot handle NoneType items. Added 'or ""' fallback so None is coerced to empty string, matching the initialized default. Added test_pptx_llm_returns_none that mocks an LLM client returning None content and verifies conversion completes without TypeError.
zashed
approved these changes
Feb 27, 2026
zashed
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1534
Problem
When an LLM client returns
Noneas the message content (e.g., content filtering, API errors, or unexpected responses),PptxConvertercrashes with:This happens on line 139 of
_pptx_converter.pywhere"\n".join([llm_description, alt_text])is called, butllm_descriptionisNone(returned byllm_caption()which has return typeUnion[None, str]).Fix
Added
or ""fallback afterllm_caption()call so that aNonereturn is coerced to empty string, matching the initialized default on line 98. This is a 4-character change.Test
Added
test_pptx_llm_returns_noneintest_module_misc.pythat:Nonecontenttest.pptxwith the mock clientTest fails without the fix (TypeError), passes with it.
Tested locally on macOS ARM (Apple Silicon). Full test suite: 145 passed, 7 skipped/failed (pre-existing, due to missing optional deps like youtube-transcript-api).