Bug Report: Potential Nil Pointer Dereference in client.Do(req) Error Handling
Description
When an error occurs in client.Do(req), the returned resp variable may be nil. However, the current implementation in the error handling block directly accesses resp.StatusCode without verifying whether resp is non-nil. This can lead to a nil pointer dereference panic, causing the application to crash. The issue was detected during static code analysis (e.g., SonarQube).
https://github.com/edgexfoundry/edgex-ui-go/blob/main/internal/handler/registercenter.go
Affected Code
resp, err := client.Do(req)
if err != nil {
return "", err, resp.StatusCode // ❌ Potential nil dereference
}