fix nil pointer dereference (#51978)

pull/51062/head^2
Artur Wierzbicki 3 years ago committed by GitHub
parent 704a602d8c
commit c372b892ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      pkg/services/searchV2/extract/dashboard.go

@ -35,7 +35,11 @@ func (d *datasourceVariableLookup) getDsRefsByTemplateVariableValue(value string
// get the actual default DS
candidateDs = d.dsLookup.ByRef(nil)
}
return []DataSourceRef{*candidateDs}
if candidateDs != nil {
return []DataSourceRef{*candidateDs}
}
return []DataSourceRef{}
case "$__all":
// TODO: filter datasources by template variable's regex
return d.dsLookup.ByType(datasourceType)

Loading…
Cancel
Save