Failed assert on MusicXML import

• Nov 10, 2018 - 17:38
Reported version
3.0
Priority
P1 - High
Type
Functional
Frequency
Many
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project

The changes for #277699: Staff properties corrupted on MusicXML import after Master Palette opened in commit 1edd676 indeed behave as expected and crash the MusicXML import with a failed assertion ('ASSERT: "!empty()" in file .../MuseScore/libmscore/stafftypelist.cpp, line 44').

This is consistent with the comment in the pull request: "and adds some assertions which may lead to crashes (and helps detecting bad code)". Apparently the MusicXML importer qualifies as "bas code" :-).

The change described in my Nov 3, 2018 - 17:53 reply to #277699: Staff properties corrupted on MusicXML import after Master Palette opened also fixes the failed assert.


Comments

But isn't that change pretty over-simplistic? Changing if (st == StaffTypes::TAB_DEFAULT ...) to if (true), rather than eliminating the if() entirely?

In reply to by Jojo-Schmitz

Yes, of course. I have no intention to leave "if (true)" in the code, but couldn't find a better way to phrase the change when I replied.

The change does not seem sufficient, as (besides fixing the failed assertion), it also introduces a warning: "libmscore/staff.cpp:Ms::Staff::setStaffType: there is already a type at 0". Am investigating.