Merge pull request #523 from nextcloud/fix-navigation-apps

Fixes crash on mac OS and linux.
This commit is contained in:
Camila Ayres 2018-08-01 15:45:06 +02:00 committed by GitHub
commit 00e2d4ef93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -818,23 +818,22 @@ void ownCloudGui::buildNavigationAppsMenu(AccountStatePtr account, QMenu *accoun
void ownCloudGui::slotNavigationAppsFetched(const QJsonDocument &reply, int statusCode)
{
auto account = qvariant_cast<AccountStatePtr>(sender()->property(propertyAccountC));
auto accountMenu = qvariant_cast<QMenu*>(sender()->property(propertyMenuC));
if (statusCode == 304) {
qCWarning(lcApplication) << "Status code " << statusCode << " Not Modified - No new navigation apps.";
} else {
if(!reply.isEmpty()){
auto element = reply.object().value("ocs").toObject().value("data");
auto navLinks = element.toArray();
if(account){
if(auto account = qvariant_cast<AccountStatePtr>(sender()->property(propertyAccountC))){
if (statusCode == 304) {
qCWarning(lcApplication) << "Status code " << statusCode << " Not Modified - No new navigation apps.";
} else {
if(!reply.isEmpty()){
auto element = reply.object().value("ocs").toObject().value("data");
auto navLinks = element.toArray();
_navApps.insert(account, navLinks);
}
}
}
}
if(accountMenu)
buildNavigationAppsMenu(account, accountMenu);
if(QObject *accountMenuObj = qvariant_cast<QObject*>(sender()->property(propertyMenuC))){
if(QMenu *accountMenu = dynamic_cast<QMenu*>(accountMenuObj))
buildNavigationAppsMenu(account, accountMenu);
}
}
}
void ownCloudGui::slotOcsError(int statusCode, const QString &message)