diff --git a/src/serverlistquerier.cpp b/src/serverlistquerier.cpp index 9ba5904a6..41b2b3ea2 100644 --- a/src/serverlistquerier.cpp +++ b/src/serverlistquerier.cpp @@ -117,17 +117,12 @@ std::optional ServerListQuerier::parseJson(const QByteArray &data) QJsonObject providerObj = providerValue.toObject(); auto jidIt = providerObj.find("jid"); - if (jidIt == providerObj.end() || !jidIt->isString()) { + QString jid; + if (jidIt == providerObj.end() || !jidIt->isString() || (jid = jidIt->toString()).isEmpty()) { parsingErrorOccurred = true; continue; // Skip if "jid" is not found or is not a string } - - QString jid = jidIt->toString(); - if (!jid.isEmpty()) { - jidList.append(jid); - } else { - parsingErrorOccurred = true; // Handle empty jid case - } + jidList.append(jid); } // Emit an error if the list is empty and there was a parsing error diff --git a/src/serverlistquerier.h b/src/serverlistquerier.h index 9d148200b..fe2e2a4fa 100644 --- a/src/serverlistquerier.h +++ b/src/serverlistquerier.h @@ -23,6 +23,8 @@ #include #include +#include + class QNetworkAccessManager; class ServerListQuerier : public QObject {