Skip to content

Commit

Permalink
Merge pull request #74 from martindstone/caching-bugfix-2
Browse files Browse the repository at this point in the history
fix crash related to changes in data structures
  • Loading branch information
Scott McAllister authored Dec 10, 2021
2 parents 31ef1ee + dc637a1 commit b65de43
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pagerduty/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,9 @@ func (s *UserService) GetContactMethod(userID string, contactMethodID string) (*
u := fmt.Sprintf("/users/%s/contact_methods/%s", userID, contactMethodID)
v := new(ContactMethodPayload)

if err := cacheGetContactMethod(contactMethodID, v); err == nil {
return v.ContactMethod, nil, nil
cv := new(ContactMethod)
if err := cacheGetContactMethod(contactMethodID, cv); err == nil {
return cv, nil, nil
}

resp, err := s.client.newRequestDo("GET", u, nil, nil, &v)
Expand Down Expand Up @@ -377,8 +378,9 @@ func (s *UserService) GetNotificationRule(userID string, ruleID string) (*Notifi
u := fmt.Sprintf("/users/%s/notification_rules/%s", userID, ruleID)
v := new(NotificationRulePayload)

if err := cacheGetNotificationRule(ruleID, v); err == nil {
return v.NotificationRule, nil, nil
cv := new(NotificationRule)
if err := cacheGetNotificationRule(ruleID, cv); err == nil {
return cv, nil, nil
}

resp, err := s.client.newRequestDo("GET", u, nil, nil, &v)
Expand Down

0 comments on commit b65de43

Please sign in to comment.