mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Fix crashes in out-of-range clicks
This commit is contained in:
parent
9ca99f9e7e
commit
3400f67059
|
@ -1499,7 +1499,7 @@ std::string VLSong::GetWord(size_t stanza, size_t measure, VLFraction at)
|
||||||
{
|
{
|
||||||
std::string word;
|
std::string word;
|
||||||
|
|
||||||
do {
|
while (measure < fMeasures.size()) {
|
||||||
VLMeasure & meas = fMeasures[measure];
|
VLMeasure & meas = fMeasures[measure];
|
||||||
VLNoteList::iterator note = meas.fMelody.begin();
|
VLNoteList::iterator note = meas.fMelody.begin();
|
||||||
VLNoteList::iterator end = meas.fMelody.end();
|
VLNoteList::iterator end = meas.fMelody.end();
|
||||||
|
@ -1519,13 +1519,20 @@ std::string VLSong::GetWord(size_t stanza, size_t measure, VLFraction at)
|
||||||
++note;
|
++note;
|
||||||
}
|
}
|
||||||
at = 0;
|
at = 0;
|
||||||
} while (++measure < fMeasures.size());
|
++measure;
|
||||||
|
}
|
||||||
|
|
||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VLSong::SetWord(size_t stanza, size_t measure, VLFraction at, std::string word, size_t * nextMeas, VLFract * nextAt)
|
void VLSong::SetWord(size_t stanza, size_t measure, VLFraction at, std::string word, size_t * nextMeas, VLFract * nextAt)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Always keep an empty measure in reserve
|
||||||
|
//
|
||||||
|
while (measure+1 >= fMeasures.size())
|
||||||
|
AddMeasure();
|
||||||
|
|
||||||
uint8_t kind = 0;
|
uint8_t kind = 0;
|
||||||
bool cleanup = false;
|
bool cleanup = false;
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,9 @@ std::string NormalizeName(NSString* rawName)
|
||||||
|
|
||||||
- (NSString *) stringValue
|
- (NSString *) stringValue
|
||||||
{
|
{
|
||||||
|
if (fMeasure >= fSong->CountMeasures())
|
||||||
|
return @"";
|
||||||
|
|
||||||
const VLMeasure measure = fSong->fMeasures[fMeasure];
|
const VLMeasure measure = fSong->fMeasures[fMeasure];
|
||||||
const VLChordList & chords = measure.fChords;
|
const VLChordList & chords = measure.fChords;
|
||||||
VLFraction at(0);
|
VLFraction at(0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user