diff --git a/pkg/services/searchV2/extract/dashboard.go b/pkg/services/searchV2/extract/dashboard.go index 5ed56f689b6..1ff4a6a5866 100644 --- a/pkg/services/searchV2/extract/dashboard.go +++ b/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)