You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2018/07/23 15:56:59 UTC
[trafficcontrol] 02/02: protect against nil
This is an automated email from the ASF dual-hosted git repository.
dewrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit fe3843694fa3c6e77381eb8c7aa775e5344da976
Author: Dan Kirkwood <da...@apache.org>
AuthorDate: Mon Jul 23 09:50:16 2018 -0600
protect against nil
---
traffic_ops/traffic_ops_golang/tenant/tenant.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/traffic_ops/traffic_ops_golang/tenant/tenant.go b/traffic_ops/traffic_ops_golang/tenant/tenant.go
index b6d4ec0..8bc9e0c 100644
--- a/traffic_ops/traffic_ops_golang/tenant/tenant.go
+++ b/traffic_ops/traffic_ops_golang/tenant/tenant.go
@@ -159,6 +159,11 @@ func (ten *TOTenant) Create() (error, tc.ApiErrorType) {
func (ten *TOTenant) Read(parameters map[string]string) ([]interface{}, []error, tc.ApiErrorType) {
var rows *sqlx.Rows
+ if ten.ReqInfo == nil || ten.ReqInfo.User == nil {
+ // should never happen
+ return nil, []error{errors.New("missing request info")}, tc.SystemError
+ }
+
tenantID := ten.ReqInfo.User.TenantID
if tenantID == auth.TenantIDInvalid {
// NOTE: work around issue where user has no tenancy assigned. If tenancy turned off, there