mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Check Season Range after edit/load
.. to make sure the date range is not negative, since that causes SEGV all over the codebase, which assumes a date range is always positive.
This commit is contained in:
@@ -983,6 +983,13 @@ LTMSidebar::addRange()
|
||||
|
||||
active = true;
|
||||
|
||||
// check dates are right way round...
|
||||
if (newOne.start > newOne.end) {
|
||||
QDate temp = newOne.start;
|
||||
newOne.start = newOne.end;
|
||||
newOne.end = temp;
|
||||
}
|
||||
|
||||
// save
|
||||
seasons->seasons.insert(0, newOne);
|
||||
seasons->writeSeasons();
|
||||
@@ -1011,6 +1018,13 @@ LTMSidebar::editRange()
|
||||
|
||||
active = true;
|
||||
|
||||
// check dates are right way round...
|
||||
if (seasons->seasons[index].start > seasons->seasons[index].end) {
|
||||
QDate temp = seasons->seasons[index].start;
|
||||
seasons->seasons[index].start = seasons->seasons[index].end;
|
||||
seasons->seasons[index].end = temp;
|
||||
}
|
||||
|
||||
// update name
|
||||
dateRangeTree->selectedItems().first()->setText(0, seasons->seasons[index].getName());
|
||||
|
||||
|
||||
@@ -65,6 +65,14 @@ bool SeasonParser::endElement( const QString&, const QString&, const QString &qN
|
||||
seasons[seasons.size()-1].setEnd(season.getStart());
|
||||
}
|
||||
if (season.getStart().isValid() && season.getEnd().isValid()) {
|
||||
|
||||
// just check the dates are the right way around
|
||||
if (season.start > season.end) {
|
||||
QDate temp = season.start;
|
||||
season.start = season.end;
|
||||
season.end = temp;
|
||||
}
|
||||
|
||||
seasons.append(season);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user