From: Kevin Ottens Date: Mon, 15 Jun 2020 18:20:40 +0000 (+0200) Subject: Don't call method on potentially null object X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~150 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=73a689bc39734d1664fe0ab09479f18063abb733;p=nextcloud-desktop.git Don't call method on potentially null object We were calling accountState() on a "folder" member which could be nullptr. In fact this would happen any time one right click on a file outside of a sync dir under Windows, this thus led to a crash. Since the capabilities variable was unused anyway, we just removed it. Signed-off-by: Kevin Ottens --- diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 3daa9bc23..ad5e5758b 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -799,7 +799,6 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe FileData fileData = hasSeveralFiles ? FileData{} : FileData::get(argument); bool isOnTheServer = fileData.journalRecord().isValid(); auto flagString = isOnTheServer ? QLatin1String("::") : QLatin1String(":d:"); - auto capabilities = fileData.folder->accountState()->account()->capabilities(); if (fileData.folder && fileData.folder->accountState()->isConnected()) { DirectEditor* editor = getDirectEditorForLocalFile(fileData.localPath);