mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Fix JSON reader ignoring open fail
D'oh. The ridefile reader for JSON files spotted when a file failed to open but then continued to try and parse it! Now returns NULL when fopen fails. This is particularly relevant when using foreign characters in a filename passed to fopen(). We need to remove the fopen stuff and replace if QFile reading to a buffer.
This commit is contained in:
@@ -247,7 +247,8 @@ JsonFileReader::openRideFile(QFile &file, QStringList &errors, QList<RideFile*>*
|
||||
// JsonRideFilein is the FILE * used by the lexer
|
||||
JsonRideFilein = fopen(file.fileName().toLatin1(), "r");
|
||||
if (JsonRideFilein == NULL) {
|
||||
errors << "unable to open file" + file.fileName();
|
||||
errors << "unable to open file (locale?)" + file.fileName();
|
||||
return NULL; // failed to open the file ?
|
||||
}
|
||||
// inform the parser/lexer we have a new file
|
||||
JsonRideFilerestart(JsonRideFilein);
|
||||
|
||||
Reference in New Issue
Block a user