mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Fix crasher on empty selection
This commit is contained in:
parent
fc5873c2d2
commit
c081a320a1
|
@ -289,21 +289,23 @@ VLSequenceCallback(
|
||||||
- (BOOL)validateUserInterfaceItem:(id) item
|
- (BOOL)validateUserInterfaceItem:(id) item
|
||||||
{
|
{
|
||||||
SEL action = [item action];
|
SEL action = [item action];
|
||||||
|
bool hasSelection = fSelEnd != kNoMeasure && fSelStart <= fSelEnd;
|
||||||
|
bool hasSelectionRange = fSelEnd != kNoMeasure && fSelStart < fSelEnd;
|
||||||
if (action == @selector(cut:)
|
if (action == @selector(cut:)
|
||||||
|| action == @selector(copy:)
|
|| action == @selector(copy:)
|
||||||
|| action == @selector(delete:)
|
|| action == @selector(delete:)
|
||||||
)
|
)
|
||||||
return fSelStart < fSelEnd;
|
return hasSelectionRange;
|
||||||
else if (action == @selector(editRepeat:))
|
else if (action == @selector(editRepeat:))
|
||||||
return fSelEnd > fSelStart
|
return hasSelectionRange
|
||||||
&& [self song]->CanBeRepeat(fSelStart, fSelEnd);
|
&& [self song]->CanBeRepeat(fSelStart, fSelEnd);
|
||||||
else if (action == @selector(editRepeatEnding:))
|
else if (action == @selector(editRepeatEnding:))
|
||||||
return fSelEnd > fSelStart
|
return hasSelectionRange
|
||||||
&& [self song]->CanBeEnding(fSelStart, fSelEnd);
|
&& [self song]->CanBeEnding(fSelStart, fSelEnd);
|
||||||
else if (action == @selector(paste:))
|
else if (action == @selector(paste:))
|
||||||
return fSelStart <= fSelEnd;
|
return hasSelection;
|
||||||
else if (action == @selector(insertMeasure:))
|
else if (action == @selector(insertMeasure:))
|
||||||
return fSelStart == fSelEnd;
|
return hasSelection && !hasSelectionRange;
|
||||||
else
|
else
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user