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

mattjackson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 57f2f61  Adding nil checks before dereferencing (#5492)
57f2f61 is described below

commit 57f2f61f86cec913a04cd37d648ac092b10df690
Author: Srijeet Chatterjee <[email protected]>
AuthorDate: Fri Feb 5 10:55:09 2021 -0700

    Adding nil checks before dereferencing (#5492)
---
 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 {

Reply via email to