Skip to content

Commit

Permalink
Add cursor value check
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-pease authored and tluijken committed May 30, 2024
1 parent e42f4a3 commit b31edfc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stellar_rust_sdk_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub fn pagination_macro(input: TokenStream) -> TokenStream {
impl Paginatable for #struct_name {
fn set_cursor(self, cursor: u32) -> Result<Self, String> {
// Always accept the cursor since it's non-optional in the setter
if cursor < 1 {
return Err("Cursor must be greater than or equal to 1.".to_string());
}

Ok(Self { cursor: Some(cursor), ..self })
}

Expand Down

0 comments on commit b31edfc

Please sign in to comment.