aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/persistance/FileBackend.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-09-03 20:31:32 +0200
committerChristian Schneppe <christian@pix-art.de>2019-09-03 20:31:32 +0200
commitbe82ac563323ed83427b3ad692650c8283ce5338 (patch)
tree53dfcd82ec65e0b523c3790c3b57539a2aa0442b /src/main/java/de/pixart/messenger/persistance/FileBackend.java
parent4aa24e84c49348f8d96c273f77a636557dbb40a2 (diff)
fix some crashes
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 962496dcb..235547c1d 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -719,7 +719,10 @@ public class FileBackend {
frame = metadataRetriever.getFrameAtTime(0);
metadataRetriever.release();
frame = resize(frame, size);
- } catch (IOException | RuntimeException e) {
+ } catch (IOException e) {
+ frame = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
+ frame.eraseColor(0xff000000);
+ } catch (RuntimeException e) {
frame = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
frame.eraseColor(0xff000000);
}
@@ -880,7 +883,9 @@ public class FileBackend {
avatar.width = options.outWidth;
avatar.type = options.outMimeType;
return avatar;
- } catch (NoSuchAlgorithmException | IOException e) {
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ } catch (IOException e) {
return null;
} finally {
close(is);
@@ -934,7 +939,11 @@ public class FileBackend {
return false;
}
avatar.size = bytes.length;
- } catch (IllegalArgumentException | IOException | NoSuchAlgorithmException e) {
+ } catch (IllegalArgumentException e) {
+ return false;
+ } catch (IOException e) {
+ return false;
+ } catch (NoSuchAlgorithmException e) {
return false;
} finally {
close(os);
@@ -970,7 +979,10 @@ public class FileBackend {
input = rotate(input, getRotation(image));
return cropCenterSquare(input, size);
}
- } catch (FileNotFoundException | SecurityException e) {
+ } catch (FileNotFoundException e) {
+ Log.d(Config.LOGTAG, "unable to open file " + image.toString(), e);
+ return null;
+ } catch (SecurityException e) {
Log.d(Config.LOGTAG, "unable to open file " + image.toString(), e);
return null;
} finally {