Skip to content

Commit

Permalink
check for nil inputs on helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
haruska committed Mar 4, 2024
1 parent 465e447 commit 9dbdc94
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pinecone/index_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ func (idx *IndexConnection) query(ctx *context.Context, req *data.QueryRequest)
}

func toVector(vector *data.Vector) *Vector {
if vector == nil {
return nil
}
return &Vector{
Id: vector.Id,
Values: vector.Values,
Expand All @@ -296,6 +299,9 @@ func toVector(vector *data.Vector) *Vector {
}

func toScoredVector(sv *data.ScoredVector) *ScoredVector {
if sv == nil {
return nil
}
v := toVector(&data.Vector{
Id: sv.Id,
Values: sv.Values,
Expand Down Expand Up @@ -335,6 +341,9 @@ func toPaginationToken(p *data.Pagination) *string {
}

func vecToGrpc(v *Vector) *data.Vector {
if v == nil {
return nil
}
return &data.Vector{
Id: v.Id,
Values: v.Values,
Expand Down

0 comments on commit 9dbdc94

Please sign in to comment.