mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 16:39:57 +00:00
Fix RawRidFile fdopen assert crash
Rather than assert it might be better to handle fdopen() calls that fail with more grace. Especially since the file wasn't being closed. Ugh.
This commit is contained in:
@@ -215,9 +215,19 @@ RideFile *RawFileReader::openRideFile(QFile &file, QStringList &errors, QList<Ri
|
||||
return NULL;
|
||||
}
|
||||
FILE *f = fdopen(file.handle(), "r");
|
||||
assert(f);
|
||||
|
||||
// failed to associate a stream!
|
||||
if (f==NULL) {
|
||||
file.close();
|
||||
delete rideFile;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ReadState state(rideFile, errors);
|
||||
pt_read_raw(f, &state, config_cb, time_cb, data_cb, error_cb);
|
||||
fclose(f);
|
||||
file.close();
|
||||
|
||||
return rideFile;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user