You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/06/17 16:33:30 UTC

[GitHub] [trafficcontrol] rob05c commented on a diff in pull request #6908: Fix t3c panic on failed TO request

rob05c commented on code in PR #6908:
URL: https://github.com/apache/trafficcontrol/pull/6908#discussion_r900309910


##########
cache-config/t3cutil/getdatacfg.go:
##########
@@ -794,10 +794,12 @@ func GetConfigData(toClient *toreq.TOClient, disableProxy bool, cacheHostName st
 		return true
 	})
 
-	err := error(nil)
-	toData.ServerParams, err = atscfg.GetServerParameters(toData.Server, combineParams(toData.ServerProfilesParams))
-	if err != nil {
-		errs = append(errs, err)
+	if len(errs) == 0 && toData.Server != nil {

Review Comment:
   No, but if there's an error, `toData.Server` may be nil, which is the panic here. 
   
   The idiomatically-correct thing to do is to stop processing any data if there are any errors, i.e. `len(errs) == 0`.
   Theoretically, if `len(errs) == 0` then `toData.Server` should never be nil here; the `toData.Server != nil` is just an additional safety, before dereferencing it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org