Skip to content

Commit

Permalink
fix (#663): Treat array of None from actuator command manager as empty
Browse files Browse the repository at this point in the history
If we get back a Vec<Option<Hardwarecommand>> that isn't empty but is
nothing but None, treat it as empty. Otherwise we'll spam devices with
very weird output.
  • Loading branch information
qdot committed Oct 2, 2024
1 parent ef03581 commit 5ae3f4b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions buttplug/src/server/device/server_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,10 @@ impl ServerDevice {
Err(err) => return future::ready(Err(err)).boxed(),
};

if commands.is_empty() {
if commands.is_empty() || commands.iter().filter(|x| x.is_some()).count() == 0 {
trace!("No commands generated for incoming device packet, skipping and returning success.");
return future::ready(Ok(message::OkV0::default().into())).boxed();
}

self.handle_generic_command_result(self.handler.handle_scalar_cmd(&commands))
}

Expand Down

0 comments on commit 5ae3f4b

Please sign in to comment.