PreviewImageActivity: don't try to use virtual folder is type is NONE

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey Vilas 2022-02-25 16:38:45 +01:00 committed by Álvaro Brey (Rebase PR Action)
parent 1954584741
commit eeee11e427
2 changed files with 8 additions and 2 deletions

View file

@ -60,6 +60,8 @@ import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.theme.ThemeToolbarUtils;
import java.io.Serializable;
import javax.inject.Inject;
import androidx.annotation.NonNull;
@ -137,8 +139,9 @@ public class PreviewImageActivity extends FileActivity implements
private void initViewPager(User user) {
// virtual folder
if (getIntent().getSerializableExtra(EXTRA_VIRTUAL_TYPE) != null) {
VirtualFolderType type = (VirtualFolderType) getIntent().getSerializableExtra(EXTRA_VIRTUAL_TYPE);
final Serializable virtualFolderType = getIntent().getSerializableExtra(EXTRA_VIRTUAL_TYPE);
if (virtualFolderType != null && virtualFolderType != VirtualFolderType.NONE) {
VirtualFolderType type = (VirtualFolderType) virtualFolderType;
mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(),
type,

View file

@ -110,6 +110,9 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
if (type == null) {
throw new IllegalArgumentException("NULL parent folder");
}
if(type == VirtualFolderType.NONE){
throw new IllegalArgumentException("NONE virtual folder type");
}
if (storageManager == null) {
throw new IllegalArgumentException("NULL storage manager");
}