This is an automated email from the ASF dual-hosted git repository. maxyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry-go-libs.git
commit 0ced619f8d1225877158ad387639c49e5edd18bc Author: Brandon Tat <[email protected]> AuthorDate: Wed May 22 14:06:55 2024 -0700 Add length check before returning first index of segmentList (#91) This commit adds a length check on the segmentList within getSegmentByRole() before returning the first index to avoid panicking. --- cluster/cluster.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cluster/cluster.go b/cluster/cluster.go index 6643b97..62ccd85 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -435,6 +435,9 @@ func getSegmentByRole(segmentList []*SegConfig, role ...string) *SegConfig { } return segmentList[1] } + if len(segmentList) == 0 { + return nil + } return segmentList[0] } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
