Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: List Index out out range with empty parts [] #138

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

Andy963
Copy link
Contributor

@Andy963 Andy963 commented Dec 19, 2023

while question was blocked by api, the parts is an empty list [], so the exp:
if len(parts) > 1 or "text" not in parts[0]:
will raise list index out of range, but not ValueError

Description of the change

check parts before parts[0]

Motivation

Type of change

Choose one: (Bug fix | Feature request | Documentation | Other)
Bug fix

Checklist

  • I have performed a self-review of my code.
  • I have added detailed comments to my code where applicable.
  • I have verified that my change does not break existing code.
  • My PR is based on the latest changes of the main branch (if unsure, please run git pull --rebase upstream main).
  • I am familiar with the Google Style Guide for the language I have coded in.
  • I have read through the Contributing Guide and signed the Contributor License Agreement.

while question was blocked by api, the parts is an empty list [], 
so the exp: 
if len(parts) > 1 or "text" not in parts[0]:
will raise list index out of range, but not ValueError
@Andy963 Andy963 requested a review from a team as a code owner December 19, 2023 08:22
@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:python sdk Issue/PR related to Python SDK labels Dec 19, 2023
@MarkDaoust MarkDaoust merged commit 0a9596f into google-gemini:main Dec 19, 2023
6 checks passed
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:python sdk Issue/PR related to Python SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants