Skip to content

Commit 7ddf9f7

Browse files
committed
Don't panic on empty var Druid query
1 parent 0b38b01 commit 7ddf9f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/tsdb/druid/druid.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,11 @@ func (ds *Service) oldExecuteQuery(queryRef string, q druidquerybuilder.Query, s
608608
err := json.Unmarshal(res, &tn)
609609
if err == nil && len(tn) > 0 {
610610
columns := []string{"timestamp"}
611-
for c := range tn[0]["result"].([]interface{})[0].(map[string]interface{}) {
612-
columns = append(columns, c)
611+
results := tn[0]["result"].([]interface{})
612+
if len(results) > 0 {
613+
for c := range results[0].(map[string]interface{}) {
614+
columns = append(columns, c)
615+
}
613616
}
614617
for _, result := range tn {
615618
for _, record := range result["result"].([]interface{}) {

0 commit comments

Comments
 (0)