OpenNBS / OpenNoteBlockStudio

An open-source Minecraft music maker.
https://opennbs.org/
MIT License
730 stars 50 forks source link

Crash when pasting custom instruments in a song with no custom instruments #356

Open Bentroen opened 1 year ago

Bentroen commented 1 year ago

If you copy a note block which is a custom instrument, then make a new song, paste it, and then play the song, the program crashes.

Likely, the instrument ID becomes out-of-range, and somewhere down where NBS processes the pasted note blocks, it tries to read an invalid array index.

This behavior will likely not be patched in the current version, but we should make sure a failsafe is in place for the rewrite (either prevent the selection from being pasted with a popup warning, or create empty custom instruments up until the largest index present on the selection).