Azure: Fix possible nil pointer dereference (#111051)
* Fix possible nil pointer dereference * Update pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go Co-authored-by: Adam Yeats <16296989+adamyeats@users.noreply.github.com> --------- Co-authored-by: Adam Yeats <16296989+adamyeats@users.noreply.github.com>
This commit is contained in:
co-authored by
Adam Yeats
parent
75286f11f0
commit
00d47ceb29
@@ -128,7 +128,11 @@ func (e *AzureLogAnalyticsDatasource) ResourceRequest(rw http.ResponseWriter, re
|
||||
req.URL.RawQuery = queryParams.Encode()
|
||||
resp, err := cli.Do(req)
|
||||
if err != nil {
|
||||
return nil, writeErrorResponse(rw, resp.StatusCode, fmt.Sprintf("failed to fetch metadata: %s", err))
|
||||
statusCode := http.StatusInternalServerError
|
||||
if resp != nil {
|
||||
statusCode = resp.StatusCode
|
||||
}
|
||||
return nil, writeErrorResponse(rw, statusCode, fmt.Sprintf("failed to fetch metadata: %v", err))
|
||||
}
|
||||
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user