Export fails with "list index out of range"
Closed this issue · 0 comments
This line tries to read the layer that a note is contained within:
If this layer doesn't exist in the file - because it's empty and doesn't need to be saved -, the export will fail with "list index out of range". This is a screenshot from Note Block Studio 3.10.0, which embeds nbswave 0.3.0:
This is not an issue most of the time because, as an implementation detail, Note Block Studio saves all loaded layers to the file, even if they are empty - incidentally, this means that every note block in the song is guaranteed to have a layer associated with it. However, as this is not required in the NBS specification, files saved with third-party tools may not have a layer entry for every layer with a note block, yet still load correctly in NBS.
A safeguard should be added when doing index checks so that the volume and panning attributes default to those of an empty layer.
NOTE: This is likely possible to happen in other indexed lookups as well, such as the note's instrument.