You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2021/04/01 20:20:01 UTC

[trafficcontrol] branch 5.1.x updated: Adding nil checks before dereferencing (#5492)

This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/5.1.x by this push:
     new b1aaf87  Adding nil checks before dereferencing (#5492)
b1aaf87 is described below

commit b1aaf8740c9d91b8496825dbe8e2d7297149144b
Author: Srijeet Chatterjee <30...@users.noreply.github.com>
AuthorDate: Fri Feb 5 10:55:09 2021 -0700

    Adding nil checks before dereferencing (#5492)
    
    (cherry picked from commit 57f2f61f86cec913a04cd37d648ac092b10df690)
---
 traffic_monitor/towrap/towrap.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/traffic_monitor/towrap/towrap.go b/traffic_monitor/towrap/towrap.go
index 577f490..1b6b541 100644
--- a/traffic_monitor/towrap/towrap.go
+++ b/traffic_monitor/towrap/towrap.go
@@ -343,7 +343,9 @@ func (s TrafficOpsSessionThreadsafe) CRConfigRaw(cdn string) ([]byte, error) {
 		b, reqInf, e := ss.GetCRConfig(cdn)
 		err = e
 		data = b
-		remoteAddr = reqInf.RemoteAddr.String()
+		if reqInf.RemoteAddr != nil {
+			remoteAddr = reqInf.RemoteAddr.String()
+		}
 	} else {
 		ss := s.get()
 		if ss == nil {
@@ -352,7 +354,9 @@ func (s TrafficOpsSessionThreadsafe) CRConfigRaw(cdn string) ([]byte, error) {
 		b, reqInf, e := ss.GetCRConfig(cdn)
 		err = e
 		data = b
-		remoteAddr = reqInf.RemoteAddr.String()
+		if reqInf.RemoteAddr != nil {
+			remoteAddr = reqInf.RemoteAddr.String()
+		}
 	}
 
 	if err == nil {