Julusian / node-midi

A node.js wrapper for RtMidi providing MIDI I/O
https://www.npmjs.com/package/@julusian/midi
MIT License
22 stars 7 forks source link

fix: Only close output midi port if an underlying client exists #5

Closed hlxid closed 1 year ago

hlxid commented 1 year ago

If the underlying RtMidiOut client could not be successfully created in the constructor handle will be set to a nullptr.

Before this patch the closePort method would be called on a null value resulting in a segmentation fault that crashes the whole node.js process in which the library is used.

The input class already has this check implemented, it is only missing in the output class.

Julusian commented 1 year ago

Thanks, I don't know why I didn't spot/think of this when doing 2f4d70a65cc2ec3f424fc8ea24c060826b15c220

Julusian commented 1 year ago

This is published in v3.0.1