mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-08 04:49:58 -05:00
updater: Fix a crash and handle redirects
This commit is contained in:
@@ -1275,10 +1275,23 @@ void MainWindow::httpresponse(QNetworkReply *reply)
|
|||||||
|
|
||||||
if(reply->error() == QNetworkReply::NoError)
|
if(reply->error() == QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
|
// Check for redirect
|
||||||
|
QVariant possibleRedirectUrl =
|
||||||
|
reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||||
|
|
||||||
|
if(!possibleRedirectUrl.toUrl().isEmpty())
|
||||||
|
{
|
||||||
|
m_NetworkManager->get(QNetworkRequest(possibleRedirectUrl.toUrl()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// first line of the currentrelease file contains a major.minor.patch version string
|
// first line of the currentrelease file contains a major.minor.patch version string
|
||||||
QString sversion(reply->readLine());
|
QString sversion(reply->readLine());
|
||||||
|
|
||||||
QStringList versiontokens = sversion.split(".");
|
QStringList versiontokens = sversion.split(".");
|
||||||
|
if(versiontokens.size() < 3)
|
||||||
|
return;
|
||||||
|
|
||||||
int major = versiontokens[0].toInt();
|
int major = versiontokens[0].toInt();
|
||||||
int minor = versiontokens[1].toInt();
|
int minor = versiontokens[1].toInt();
|
||||||
int patch = versiontokens[2].toInt();
|
int patch = versiontokens[2].toInt();
|
||||||
|
|||||||
Reference in New Issue
Block a user