aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/persistance/FileBackend.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-08-16 17:31:53 +0200
committeriNPUTmice <daniel@gultsch.de>2014-08-16 17:31:53 +0200
commit38f36aa2631f863d927f417b3758eb7969b31111 (patch)
treea8b33c1e803fa508dd30c7c48e550cff5afadbd7 /src/eu/siacs/conversations/persistance/FileBackend.java
parent5aa8afdc1c0c60a47f8e93076697ad65e702764d (diff)
more error handling for avatar publication
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/persistance/FileBackend.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/persistance/FileBackend.java b/src/eu/siacs/conversations/persistance/FileBackend.java
index 4db46009..f4067f87 100644
--- a/src/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/eu/siacs/conversations/persistance/FileBackend.java
@@ -285,6 +285,9 @@ public class FileBackend {
try {
Avatar avatar = new Avatar();
Bitmap bm = cropCenterSquare(image, size);
+ if (bm==null) {
+ return null;
+ }
ByteArrayOutputStream mByteArrayOutputStream = new ByteArrayOutputStream();
Base64OutputStream mBase64OutputSttream = new Base64OutputStream(mByteArrayOutputStream, Base64.DEFAULT);
MessageDigest digest = MessageDigest.getInstance("SHA-1");
@@ -355,7 +358,11 @@ public class FileBackend {
InputStream is = context.getContentResolver()
.openInputStream(image);
Bitmap input = BitmapFactory.decodeStream(is, null, options);
- return cropCenterSquare(input, size);
+ if (input==null) {
+ return null;
+ } else {
+ return cropCenterSquare(input, size);
+ }
} catch (FileNotFoundException e) {
return null;
}