fix: handle a potential nil iterator leading to a panic (#23520)
* fix: handle a potential nil iterator leading to a panic * chore: cleanuppull/23844/head
parent
1033334482
commit
9582826b3f
|
@ -547,10 +547,18 @@ func (s *Store) measurementFields(ctx context.Context, mqAttrs *metaqueryAttribu
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer func() { _ = iter.Close() }()
|
defer func() {
|
||||||
|
if iter != nil {
|
||||||
|
_ = iter.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
var fieldNames []string
|
var fieldNames []string
|
||||||
fitr := iter.(query.FloatIterator)
|
fitr, ok := iter.(query.FloatIterator)
|
||||||
|
if !ok {
|
||||||
|
return cursors.NewStringSliceIterator(fieldNames), nil
|
||||||
|
}
|
||||||
|
|
||||||
for p, _ := fitr.Next(); p != nil; p, _ = fitr.Next() {
|
for p, _ := fitr.Next(); p != nil; p, _ = fitr.Next() {
|
||||||
if len(p.Aux) >= 1 {
|
if len(p.Aux) >= 1 {
|
||||||
fieldNames = append(fieldNames, p.Aux[0].(string))
|
fieldNames = append(fieldNames, p.Aux[0].(string))
|
||||||
|
|
Loading…
Reference in New Issue