diff options
Diffstat (limited to 'lib/syncdata.cpp')
-rw-r--r-- | lib/syncdata.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/syncdata.cpp b/lib/syncdata.cpp index 6e68e2cd..a9ec5ee7 100644 --- a/lib/syncdata.cpp +++ b/lib/syncdata.cpp @@ -157,10 +157,14 @@ QJsonObject SyncData::loadJson(const QString& fileName) } auto data = roomFile.readAll(); - const auto json = (data.startsWith('{') - ? QJsonDocument::fromJson(data) - : QJsonDocument::fromBinaryData(data)) - .object(); + const auto json = data.startsWith('{') + ? QJsonDocument::fromJson(data).object() +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + : QCborValue::fromCbor(data).toJsonValue().toObject() +#else + : QJsonDocument::fromBinaryData(data).object() +#endif + ; if (json.isEmpty()) { qCWarning(MAIN) << "State cache in" << fileName << "is broken or empty, discarding"; |