Skip to content

Commit

Permalink
updater: Fix a crash and handle redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
rp- committed Apr 28, 2014
1 parent 5b305b0 commit fbb6fe5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,10 +1269,23 @@ void MainWindow::httpresponse(QNetworkReply *reply)

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
QString sversion(reply->readLine());

QStringList versiontokens = sversion.split(".");
if(versiontokens.size() < 3)
return;

int major = versiontokens[0].toInt();
int minor = versiontokens[1].toInt();
int patch = versiontokens[2].toInt();
Expand Down

0 comments on commit fbb6fe5

Please sign in to comment.