fix: handle None or empty contents in Gemini token counter (#17020)

Adds null/empty check before processing contents in GoogleAIStudioTokenCounter
to prevent errors when contents is None or empty.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Haiyi
2025-11-24 17:40:00 -08:00
committed by GitHub
co-authored by Claude
parent 629404a100
commit 84e8b9a7bf
@@ -30,6 +30,10 @@ class GoogleAIStudioTokenCounter:
from google.genai.types import FunctionResponse
# Handle None or empty contents
if not contents:
return contents
cleaned_contents = copy.deepcopy(contents)
for content in cleaned_contents: