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

Export fails with "list index out of range" #5

Closed
Bentroen opened this issue Oct 18, 2022 · 0 comments
Closed

Export fails with "list index out of range" #5

Bentroen opened this issue Oct 18, 2022 · 0 comments

Comments

@Bentroen
Copy link
Member

This line tries to read the layer that a note is contained within:

https://github.com/Bentroen/nbswave/blob/40d97f640a3b0ee8f755d4111285f4a5b9adccc9/nbswave/nbs.py#L117

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:
image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant