diff --git a/CHANGELOG.md b/CHANGELOG.md index c59d65e..0dfcb41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v5.8.1 (2026-03-10) + +- Fixes the possibility for a panic when listing claims, reports, shipments, or trackers (closes #276) + ## v5.8.0 (2026-02-25) - Adds generic `MakeAPICall` function diff --git a/claim.go b/claim.go index 80c4d04..f44aaf0 100644 --- a/claim.go +++ b/claim.go @@ -92,7 +92,9 @@ func (c *Client) ListClaims(opts *ListClaimsParameters) (out *ListClaimsResult, func (c *Client) ListClaimsWithContext(ctx context.Context, opts *ListClaimsParameters) (out *ListClaimsResult, err error) { err = c.do(ctx, http.MethodGet, "claims", opts, &out) // Store the original query parameters for reuse when getting the next page - out.Parameters = *opts + if err == nil && out != nil { + out.Parameters = *opts + } return } diff --git a/report.go b/report.go index 42b92aa..023fc3d 100644 --- a/report.go +++ b/report.go @@ -61,7 +61,9 @@ func (c *Client) ListReports(typ string, opts *ListOptions) (out *ListReportsRes func (c *Client) ListReportsWithContext(ctx context.Context, typ string, opts *ListOptions) (out *ListReportsResult, err error) { err = c.do(ctx, http.MethodGet, "reports/"+typ, opts, &out) // Store the original query parameters for reuse when getting the next page - out.Type = typ + if err == nil && out != nil { + out.Type = typ + } return } diff --git a/shipment.go b/shipment.go index 89f790b..04df4a2 100644 --- a/shipment.go +++ b/shipment.go @@ -188,8 +188,10 @@ func (c *Client) ListShipments(opts *ListShipmentsOptions) (out *ListShipmentsRe func (c *Client) ListShipmentsWithContext(ctx context.Context, opts *ListShipmentsOptions) (out *ListShipmentsResult, err error) { err = c.do(ctx, http.MethodGet, "shipments", opts, &out) // Store the original query parameters for reuse when getting the next page - out.Purchased = opts.Purchased - out.IncludeChildren = opts.IncludeChildren + if err == nil && out != nil { + out.Purchased = opts.Purchased + out.IncludeChildren = opts.IncludeChildren + } return } diff --git a/tracker.go b/tracker.go index e0921ea..0e4a868 100644 --- a/tracker.go +++ b/tracker.go @@ -165,8 +165,10 @@ func (c *Client) ListTrackers(opts *ListTrackersOptions) (out *ListTrackersResul func (c *Client) ListTrackersWithContext(ctx context.Context, opts *ListTrackersOptions) (out *ListTrackersResult, err error) { err = c.do(ctx, http.MethodGet, "trackers", opts, &out) // Store the original query parameters for reuse when getting the next page - out.TrackingCode = opts.TrackingCode - out.Carrier = opts.Carrier + if err == nil && out != nil { + out.TrackingCode = opts.TrackingCode + out.Carrier = opts.Carrier + } return } diff --git a/version.go b/version.go index 247cf17..aeeb68e 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package easypost -const Version = "5.8.0" +const Version = "5.8.1"