Skip to content

Commit

Permalink
fix: check for empty iter-/generators (#188)
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Arndt <[email protected]>
  • Loading branch information
SpotlightKid authored Oct 24, 2023
1 parent c77fb34 commit 8383d86
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/_rtmidi.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1098,9 +1098,6 @@ cdef class MidiOut(MidiBase):
"""
cdef vector[unsigned char] msg_v

if not message:
raise ValueError("'message' must not be empty.")

try:
msg_v.reserve(len(message))
except TypeError:
Expand All @@ -1109,7 +1106,9 @@ cdef class MidiOut(MidiBase):
for c in message:
msg_v.push_back(c)

if msg_v.size() > 3 and msg_v.at(0) != 0xF0:
if msg_v.size() == 0:
raise ValueError("'message' must not be empty.")
elif msg_v.size() > 3 and msg_v.at(0) != 0xF0:
raise ValueError("'message' longer than 3 bytes but does not "
"start with 0xF0.")

Expand Down

0 comments on commit 8383d86

Please sign in to comment.