fix nil pointer dereference (#51978)

This commit is contained in:
Artur Wierzbicki authored and GitHub committed 2022-07-08 19:27:53 +04:00
1 parent 704a602d8c
commit c372b892ec
1 file changed
+5 -1
+5 -1
View File
@@ -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)