Skip to content

Commit 3840423

Browse files
authored
fix: add error handling for SyncJamfProtectPlans (#790)
* fix: refactor Jamf Protect functions * refactor: remove sync plans call from CreateJamfProtectIntegration * fix: handle nil response in SyncJamfProtectPlans and propagate errors in CreateJamfProtectIntegration * fix: handle nil response check in SyncJamfProtectPlans function
1 parent aff6451 commit 3840423

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sdk/jamfpro/jamfproapi_jamf_protect.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ func (c *Client) SyncJamfProtectPlans() error {
152152

153153
resp, _ := c.HTTP.DoRequest("POST", endpoint, nil, nil)
154154

155-
if resp != nil && resp.Body != nil {
155+
if resp == nil {
156+
return fmt.Errorf("failed to sync Jamf Protect plans: received nil response")
157+
}
158+
159+
if resp.Body != nil {
156160
defer resp.Body.Close()
157161
}
158162

0 commit comments

Comments
 (0)