fix: Check for errors before reading version string
This commit is contained in:
parent
23c4cadf17
commit
87b4e3b7fe
1 changed files with 15 additions and 2 deletions
|
|
@ -57,10 +57,23 @@ void VersionChecker::checkLatest() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VersionChecker::replyFinished(QNetworkReply *reply) {
|
void VersionChecker::replyFinished(QNetworkReply *reply) {
|
||||||
auto newestVersion = QString(reply->readAll());
|
const auto httpStatus =
|
||||||
|
reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
if (reply->error() != QNetworkReply::NoError) {
|
||||||
|
qWarning(
|
||||||
|
"version check server error: %s", qPrintable(reply->errorString()));
|
||||||
|
qWarning("error checking for updates, http status: %d", httpStatus);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qInfo("version check server success, http status: %d", httpStatus);
|
||||||
|
|
||||||
|
const auto newestVersion = QString(reply->readAll());
|
||||||
|
qDebug("version check response: %s", qPrintable(newestVersion));
|
||||||
|
|
||||||
if (!newestVersion.isEmpty() &&
|
if (!newestVersion.isEmpty() &&
|
||||||
compareVersions(DESKFLOW_VERSION, newestVersion) > 0) {
|
compareVersions(DESKFLOW_VERSION, newestVersion) > 0) {
|
||||||
qDebug("update found: %s", qPrintable(newestVersion));
|
qDebug("update found");
|
||||||
emit updateFound(newestVersion);
|
emit updateFound(newestVersion);
|
||||||
} else {
|
} else {
|
||||||
qDebug("no updates found");
|
qDebug("no updates found");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue