prevent account NPE

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2018-01-09 09:52:29 +01:00
parent ae2ac1c26d
commit 213646cb41
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -236,6 +236,11 @@ public abstract class PreferenceManager {
public static String getFolderPreference(Context context, String preferenceName, OCFile folder,
String defaultValue) {
Account account = AccountUtils.getCurrentOwnCloudAccount(context);
if (account == null) {
return defaultValue;
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
FileDataStorageManager storageManager = ((ComponentsGetter)context).getStorageManager();
String value = dataProvider.getValue(account.name, getKeyFromFolder(preferenceName, folder));