Handle case where error is nil properly
@@ -1103,7 +1103,7 @@ func (s *Service) execute(w http.ResponseWriter, r *http.Request) {
}
results, resultsErr = s.cluster.Execute(er, addr, username, password, timeout)
- if resultsErr.Error() == "Unauthorized" {
+ if resultsErr != nil && resultsErr.Error() == "Unauthorized" {
http.Error(w, ErrLeaderNotFound.Error(), http.StatusUnauthorized)
return
}
