Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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
@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.

2 participants