prevent NPE if trying to store grid preference for favorites/shared

This commit is contained in:
tobiasKaminsky 2017-04-20 15:34:36 +02:00
parent fb4374d9fc
commit fe6171571f
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -1199,9 +1199,12 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
GRID_IS_PREFERED_PREFERENCE, Context.MODE_PRIVATE
);
SharedPreferences.Editor editor = setting.edit();
editor.putBoolean(String.valueOf(mFile.getFileId()), setGrid);
editor.apply();
// can be in case of favorites, shared
if (mFile != null) {
SharedPreferences.Editor editor = setting.edit();
editor.putBoolean(String.valueOf(mFile.getFileId()), setGrid);
editor.apply();
}
}
private void unsetAllMenuItems(final boolean unsetDrawer) {