fix: Check for errors before reading version string
This commit is contained in:
committed by
Chris Rizzitello
parent
23c4cadf17
commit
87b4e3b7fe
@ -57,10 +57,23 @@ void VersionChecker::checkLatest() const {
|
||||
}
|
||||
|
||||
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() &&
|
||||
compareVersions(DESKFLOW_VERSION, newestVersion) > 0) {
|
||||
qDebug("update found: %s", qPrintable(newestVersion));
|
||||
qDebug("update found");
|
||||
emit updateFound(newestVersion);
|
||||
} else {
|
||||
qDebug("no updates found");
|
||||
|
||||
Reference in New Issue
Block a user