mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-16 17:39:58 +00:00
SrmRideFile: don't assert() on bad file version
replaced assert() of file version with graceful error handling.
This commit is contained in:
@@ -268,8 +268,7 @@ RideFile *SrmFileReader::openRideFile(QFile &file, QStringList &errorStrings, QL
|
||||
watts = (ps[1] & 0x0f) | (ps[2] << 0x4);
|
||||
alt = 0.0;
|
||||
}
|
||||
else {
|
||||
assert(version == 7);
|
||||
else if (version == 7 ){
|
||||
watts = readShort(in);
|
||||
cad = readByte(in);
|
||||
hr = readByte(in);
|
||||
@@ -280,6 +279,11 @@ RideFile *SrmFileReader::openRideFile(QFile &file, QStringList &errorStrings, QL
|
||||
alt = readSignedLong(in);
|
||||
temp = 0.1 * readSignedShort(in);
|
||||
}
|
||||
else {
|
||||
errorStrings << QString("unsupported SRM file version: %1")
|
||||
.arg( version );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
result->setStartTime(blockhdrs[blknum].dt);
|
||||
|
||||
Reference in New Issue
Block a user