Skip to content

Commit

Permalink
Refactor SpinifyCommandMixin error handling and connection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed May 14, 2024
1 parent 125dc4f commit 414bf31
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/spinify_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ base mixin SpinifyCommandMixin on SpinifyBase {

@override
Future<void> _onReply(SpinifyReply reply) async {
assert(reply.id > -1, 'Reply ID should be greater or equal to 0');
assert(
reply.id >= 0 && reply.id <= _commandId,
'Reply ID should be greater or equal to 0 '
'and less or equal than command ID');
if (reply.id case int id when id > 0) {
final completer = _replies.remove(id)?.completer;
assert(
Expand Down

0 comments on commit 414bf31

Please sign in to comment.