Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check for empty iter-/generators #188

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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