From 64799eaf667840c7f81d80810508d948f64f97d6 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 23 Nov 2018 15:38:06 +0900 Subject: Connection::saveState: use null instead of an empty object for a room placeholder Otherwise placeholder objects are confused with normal room JSON objects when loading from the cache. Closes #257 (again). --- lib/syncdata.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/syncdata.cpp') diff --git a/lib/syncdata.cpp b/lib/syncdata.cpp index d141a7cc..1023ed6a 100644 --- a/lib/syncdata.cpp +++ b/lib/syncdata.cpp @@ -156,9 +156,9 @@ void SyncData::parseJson(const QJsonObject& json, const QString& baseDir) roomData.reserve(static_cast(rs.size())); for(auto roomIt = rs.begin(); roomIt != rs.end(); ++roomIt) { - auto roomJson = roomIt->isString() - ? loadJson(baseDir + fileNameForRoom(roomIt.key())) - : roomIt->toObject(); + auto roomJson = roomIt->isObject() + ? roomIt->toObject() + : loadJson(baseDir + fileNameForRoom(roomIt.key())); if (roomJson.isEmpty()) { unresolvedRoomIds.push_back(roomIt.key()); @@ -171,6 +171,8 @@ void SyncData::parseJson(const QJsonObject& json, const QString& baseDir) } totalRooms += rs.size(); } + if (!unresolvedRoomIds.empty()) + qCWarning(MAIN) << "Unresolved rooms:" << unresolvedRoomIds.join(','); if (totalRooms > 9 || et.nsecsElapsed() >= profilerMinNsecs()) qCDebug(PROFILER) << "*** SyncData::parseJson(): batch with" << totalRooms << "room(s)," -- cgit v1.2.3