Skip to content

Commit

Permalink
Fix what i broke in ArtAddressCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-dmxc committed Aug 30, 2024
1 parent c9ae436 commit 34165eb
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ArtNetSharp/Misc/ObjectTypes/ArtAddressCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ public ArtAddressCommand(in EArtAddressCommand command, in byte? x = null)

if (x.HasValue)
{
if (command == EArtAddressCommand.SetBackgroundQueuePolicy)
if (x.Value >= 4)
throw new ArgumentOutOfRangeException($"{nameof(x)} has to be between 0 and 3");
else
if (x.Value >= 15)
throw new ArgumentOutOfRangeException($"{nameof(x)} has to be between 0 and 15");
if (command != EArtAddressCommand.SetBackgroundQueuePolicy && x.Value >= 4)
throw new ArgumentOutOfRangeException($"{nameof(x)} has to be between 0 and 3");
else if (command == EArtAddressCommand.SetBackgroundQueuePolicy && x.Value >= 15)
throw new ArgumentOutOfRangeException($"{nameof(x)} has to be between 0 and 15");
}

Command = command;
Expand Down

0 comments on commit 34165eb

Please sign in to comment.