Fix #306807: Crash on [Go to first empty trailing measure] command with specific circumstance #6223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: https://musescore.org/en/node/306807
New navigation commands were implemented into 3.x (#5620 for Master -> manually added into 3.5). After 3.5Beta release, I've run into one problem that I didn't catch earlier: If issuing "Go To First Empty Trailing Measure" when there is no selection at all whatsoever + there is no first empty trailing measure, then a crash occurs! Obviously that needed to be fixed, so this PR makes sure that under that circumstance, instead of crashing, and instead of doing nothing, the result is to take the user to the last measure of the score. With this change, I had to also be consistent with the use case when using a specific staff with the same problem, i.e., no empty trailing measure. Before, nothing would happen and then the issuing of the command would be exactly equivalent to entering into Note Entry at current location. Now, this is congruous with no selection at all: take the user to the last measure, only retain the current staff in this instance.
Now I can not get this to crash at all, and in a sense there's some added functionality in that this doubles-down in allowing the user to go to the end of the score if the score is already full or has no empty trailing measure rather than doing nothing.
P.S. I will need to update accordingly the open PR mentioned at the top of this description for the master branch which has yet to be merged.
(Passes online testing)