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 | |
parent | c820c915a20a5e90fd3d98b4f18b182f6a97235a (diff) |
fix some more NPEs
Diffstat (limited to 'src/main/java')
4 files changed, 16 insertions, 3 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; diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 1735e455f..995d2ae97 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -903,7 +903,7 @@ public class XmppConnectionService extends Service { case "uncompressed": return 0; default: - return 3840; + return 1920; } } diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index bec621534..9e4f15a36 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -624,9 +624,11 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } private void onEditYourNameClicked(View view) { - String nick = ""; + String nick; if (mAccount.getDisplayName() != null) { nick = mAccount.getDisplayName(); + } else { + nick = mAccount.getJid().getLocal(); } quickEdit(nick, R.string.your_name, value -> { final String displayName = value.trim(); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 28e57396d..10ca37c7c 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -666,6 +666,9 @@ public abstract class XmppActivity extends ActionBarActivity { } protected void showAddToRosterDialog(final Contact contact) { + if (contact == null) { + return; + } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(contact.getJid().toString()); builder.setMessage(getString(R.string.not_in_roster)); |