- OCFile file = getFile();
- if (file == null) {
- throw new IllegalStateException("Instanced with a NULL OCFile");
- }
- if (mAccount == null) {
- throw new IllegalStateException("Instanced with a NULL ownCloud Account");
- }
- if (!file.isDown()) {
- throw new IllegalStateException("There is no local file to preview");
- }
- if (file.isVideo()) {
- mVideoPreview.setVisibility(View.VISIBLE);
- mImagePreview.setVisibility(View.GONE);
- prepareVideo();
+ if (file != null && file.isDown()) {
+ if (file.isVideo()) {
+ mVideoPreview.setVisibility(View.VISIBLE);
+ mImagePreview.setVisibility(View.GONE);
+ prepareVideo();