Fix crash when network information cannot be loaded
This commit is contained in:
parent
519fd40f62
commit
3b8d4f3d89
|
@ -61,7 +61,8 @@ SyncthingLauncher::SyncthingLauncher(QObject *parent)
|
|||
// initialize handling of metered connections
|
||||
#ifdef SYNCTHINGCONNECTION_SUPPORT_METERED
|
||||
QNetworkInformation::loadBackendByFeatures(QNetworkInformation::Feature::Metered);
|
||||
if (const auto *const networkInformation = QNetworkInformation::instance(); networkInformation->supports(QNetworkInformation::Feature::Metered)) {
|
||||
if (const auto *const networkInformation = QNetworkInformation::instance();
|
||||
networkInformation && networkInformation->supports(QNetworkInformation::Feature::Metered)) {
|
||||
connect(networkInformation, &QNetworkInformation::isMeteredChanged, this, [this](bool isMetered) { setNetworkConnectionMetered(isMetered); });
|
||||
setNetworkConnectionMetered(networkInformation->isMetered());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue