mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Phlare: Fix error when there are no profileTypes to send from backend (#65455)
Send empty array if no types
This commit is contained in:
parent
db6694994f
commit
abec183e37
@ -66,7 +66,13 @@ func (d *PhlareDatasource) callProfileTypes(ctx context.Context, req *backend.Ca
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
data, err := json.Marshal(res.Msg.ProfileTypes)
|
||||
var data []byte
|
||||
if res.Msg.ProfileTypes == nil {
|
||||
// Let's make sure we send at least empty array if we don't have any types
|
||||
data, err = json.Marshal([]*typesv1.ProfileType{})
|
||||
} else {
|
||||
data, err = json.Marshal(res.Msg.ProfileTypes)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user