Skip to content

Commit fbb6fe5

Browse files
committed
updater: Fix a crash and handle redirects
1 parent 5b305b0 commit fbb6fe5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/MainWindow.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,10 +1269,23 @@ void MainWindow::httpresponse(QNetworkReply *reply)
12691269

12701270
if(reply->error() == QNetworkReply::NoError)
12711271
{
1272+
// Check for redirect
1273+
QVariant possibleRedirectUrl =
1274+
reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
1275+
1276+
if(!possibleRedirectUrl.toUrl().isEmpty())
1277+
{
1278+
m_NetworkManager->get(QNetworkRequest(possibleRedirectUrl.toUrl()));
1279+
return;
1280+
}
1281+
12721282
// first line of the currentrelease file contains a major.minor.patch version string
12731283
QString sversion(reply->readLine());
12741284

12751285
QStringList versiontokens = sversion.split(".");
1286+
if(versiontokens.size() < 3)
1287+
return;
1288+
12761289
int major = versiontokens[0].toInt();
12771290
int minor = versiontokens[1].toInt();
12781291
int patch = versiontokens[2].toInt();

0 commit comments

Comments
 (0)