Skip to content

Commit

Permalink
Make descriptor offset property optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mxk authored and surban committed Jan 8, 2022
1 parent 6bf2b0c commit a7647eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bluer/src/gatt/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ pub struct DescriptorReadRequest {
impl DescriptorReadRequest {
fn from_dict(dict: &PropMap) -> DbusResult<Self> {
Ok(Self {
offset: read_prop!(dict, "offset", u16),
offset: read_opt_prop!(dict, "offset", u16).unwrap_or_default(),
link: read_opt_prop!(dict, "link", String).and_then(|v| v.parse().ok()),
})
}
Expand All @@ -1074,7 +1074,7 @@ pub struct DescriptorWriteRequest {
impl DescriptorWriteRequest {
fn from_dict(dict: &PropMap) -> DbusResult<Self> {
Ok(Self {
offset: read_prop!(dict, "offset", u16),
offset: read_opt_prop!(dict, "offset", u16).unwrap_or_default(),
link: read_opt_prop!(dict, "link", String).and_then(|v| v.parse().ok()),
prepare_authorize: read_prop!(dict, "prepare_authorize", bool),
})
Expand Down

0 comments on commit a7647eb

Please sign in to comment.