aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-09-05 20:16:50 +0200
committerChristian Schneppe <christian@pix-art.de>2016-09-05 20:16:50 +0200
commit3eee4d26bf1b58ea10d6a86fc2bdf1c64c4ec5cf (patch)
tree0907428b1e1d373611f3c35461790366f01bb450 /src/main/java/de
parent4f03a3ac3afefdb4a4bf8a85bf8c7b0b047d1294 (diff)
catch some exceptions to avoid crashes
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java b/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
index 0766a8c90..5aef4b112 100644
--- a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
@@ -10,6 +10,7 @@ import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
+import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
@@ -26,6 +27,7 @@ import com.github.rtoshiro.view.video.FullscreenVideoLayout;
import java.io.File;
import java.io.IOException;
+import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;
@@ -102,15 +104,28 @@ public class ShowFullscreenMessageActivity extends Activity {
if (intent.hasExtra("image")) {
mFileUri = intent.getParcelableExtra("image");
mFile = new File(mFileUri.getPath());
- if (mFileUri != null) {
- DisplayImage(mFile);
+ if (mFileUri != null && mFile.exists() && mFile.length() > 0) {
+ try {
+ DisplayImage(mFile);
+ } catch (Exception e) {
+ Log.d(Config.LOGTAG, "Illegal exeption :" + e);
+ Toast.makeText(ShowFullscreenMessageActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
+ finish();
+ }
} else {
Toast.makeText(ShowFullscreenMessageActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
}
} else if (intent.hasExtra("video")) {
mFileUri = intent.getParcelableExtra("video");
- if (mFileUri != null) {
- DisplayVideo(mFileUri);
+ mFile = new File(mFileUri.getPath());
+ if (mFileUri != null && mFile.exists() && mFile.length() > 0) {
+ try {
+ DisplayVideo(mFileUri);
+ } catch (Exception e) {
+ Log.d(Config.LOGTAG, "Illegal exeption :" + e);
+ Toast.makeText(ShowFullscreenMessageActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
+ finish();
+ }
} else {
Toast.makeText(ShowFullscreenMessageActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
}