Skip to content

Commit

Permalink
Added safety checks to dereferencing pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
Xemdo committed Apr 21, 2023
1 parent 128f0ca commit 224a9f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,19 @@ func NewRequest(method string, path string, queryParameters []string, body []byt
fmt.Printf("Error unmarshalling body: %v", err)
return
}

var cursor string = ""
if extensionsBody.Pagination != nil {
cursor = *extensionsBody.Pagination
}

apiResponse = models.APIResponse{
Data: extensionsBody.Data,
Status: extensionsBody.Status,
Error: extensionsBody.Error,
Message: extensionsBody.Message,
Pagination: &models.APIPagination{
Cursor: *extensionsBody.Pagination,
Cursor: cursor,
},
}
} else {
Expand Down

0 comments on commit 224a9f7

Please sign in to comment.