diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-02-18 21:28:07 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-02-18 21:28:07 +0100 |
commit | 1c14932e8449e40e4cb12427cae7e51791f68595 (patch) | |
tree | c3e640db6479303d127b1c6f1902f13afad2d704 /src/main/java/de/pixart/messenger/persistance | |
parent | c820c915a20a5e90fd3d98b4f18b182f6a97235a (diff) |
fix some more NPEs
Diffstat (limited to 'src/main/java/de/pixart/messenger/persistance')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 0023eec37..e85eab5c9 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -487,7 +487,15 @@ public class FileBackend { if (originalBitmap == null) { throw new FileCopyException(R.string.error_not_an_image_file); } - Bitmap scaledBitmap = resize(originalBitmap, mXmppConnectionService.getCompressImageResolutionPreference()); + int size; + if (mXmppConnectionService.getCompressImageResolutionPreference() == 0) { + int height = originalBitmap.getHeight(); + int width = originalBitmap.getWidth(); + size = height > width ? height : width; + } else { + size = mXmppConnectionService.getCompressImageResolutionPreference(); + } + Bitmap scaledBitmap = resize(originalBitmap, size); int rotation = getRotation(image); scaledBitmap = rotate(scaledBitmap, rotation); boolean targetSizeReached = false; |