Merge pull request #4604 from nextcloud/ezaquarii/fix-npe-in-favorites

Fix NPE in Favorites when file has no local storage path
This commit is contained in:
Tobias Kaminsky 2019-10-08 08:23:38 +02:00 committed by GitHub
commit 58cac2ab2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -429,9 +429,10 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
itemViewHolder.sharedAvatars.removeAllViews();
}
if (onlyOnDevice) {
File localFile = new File(file.getStoragePath());
// npe fix: looks like file without local storage path somehow get here
final String storagePath = file.getStoragePath();
if (onlyOnDevice && storagePath != null) {
File localFile = new File(storagePath);
long localSize;
if (localFile.isDirectory()) {
localSize = FileStorageUtils.getFolderSize(localFile);