Skip to content

Commit

Permalink
fix: fallback to default activity type if not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Dec 10, 2024
1 parent 0bfa07c commit bebea1f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/presence/activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,8 @@ impl msgpack::Deserialize for Activity {
let mut input = input.take_map().ok_or("Invalid activity")?;

let ty = get_field_or_none!(input, "type", |v| v.as_str())
.ok_or("Missing 'type' field")?
.parse()
.map_err(|_| "Invalid activity type")?;
.and_then(|type_str| ActivityType::from_str(type_str).ok())
.unwrap_or_default();
let details =
remove_field_or_none!(input, "details", |v| v.take_string());
let state = remove_field_or_none!(input, "state", |v| v.take_string());
Expand Down

0 comments on commit bebea1f

Please sign in to comment.